X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fbrisk.phh;h=c6294b98df70aac5c9f04b75d0bfcd6243d0f7d2;hb=8fcf37789bd93a48c1d05f67c52035bce5490686;hp=add31a772c1c653836ff67190ab35649195fa312;hpb=1f5795fd45dcccc42e794089d14350c6b5c5fecd;p=brisk.git diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index add31a7..c6294b9 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -22,7 +22,7 @@ define(FTOK_PATH, "/var/lib/brisk"); define(LEGAL_PATH, "/tmp/legal_brisk"); define(PROXY_PATH, "/var/lib/brisk_proxy"); -define(TABLES_N, 12); +define(TABLES_N, 20); define(PLAYERS_N, 3); define(MAX_POINTS, 5); define(MAX_PLAYERS, (20 + (PLAYERS_N * TABLES_N))); @@ -55,9 +55,9 @@ define(BRISK_DEBUG, 0); $G_false = FALSE; $G_all_points = array( 11,10,4,3,2, 0,0,0,0,0 ); -$G_brisk_version = "spawn-0.0.6"; +$G_brisk_version = "spawn-0.0.9"; -$root_wellarr = Array ( 'Benvenuto in brisk (Ver. '.$G_brisk_version.'), NOVITA\': riscritta tutta l\'architettura dati del server, tutto piè veloce e leggero.', +$root_wellarr = Array ( 'Benvenuto in brisk (Ver. '.$G_brisk_version.'), NOVITA\': chiuso il bug dei tavoli bianchi, versione beta.', 'Se vuoi iscriverti alla Mailing List, cliccala!' ); $table_wellarr = Array ( 'Benvenuto al tavolo. Se almeno tre giocatori non sbloccano l\'uscita cliccando il lucchetto, chi esce non può risedersi a un qualunque tavolo per '.floor(BAN_TIME/60).' minuti.'); @@ -715,10 +715,12 @@ class Room { if (($sem = Briskin5::lock_data($table_idx)) != FALSE) { log_main("bin5 lock data success"); + $no_recovery = FALSE; if (($bri = &Briskin5::load_data($table_idx)) != FALSE) { if ($table_cur->table_token != $bri->table_token) { log_main("ERROR: not matching table_token. Room: ".$table_cur->table_token." Table: ".$bri->table_token); log_main("ERROR: not matching table_start. Room: ".$table_cur->table_start." Table: ".$bri->table_start); + $no_recovery = TRUE; $bri = FALSE; } } @@ -737,20 +739,21 @@ class Room { /* * DESTROY OF FINISHED TABLE && MOVE PLAYER TO ROOM AGAIN */ + log_main("garbage_manager: INSIDE THE END."); + for ($i = 0 ; $i < $bri_table->player_n ; $i++) { // stat must be "table" by definition $user_cur =& $this->user[$table_cur->player[$i]]; $bri_user =& $bri->user[$i]; - + $user_cur->subst = $bri_user->subst; $user_cur->step = $bri_user->step; - $user_cur->trans_step = $bri_user->step; $user_cur->lacc = $bri_user->lacc; $user_cur->laccwr = $bri_user->lacc; $user_cur->bantime = $bri_user->bantime; } - $this->room_join_wakeup(&$user_cur); + $this->room_join_wakeup(&$user_cur, FALSE, 0); $table_cur->table_token = ""; Briskin5::destroy_data($table_idx); @@ -765,9 +768,25 @@ class Room { Briskin5::save_data(&$bri); } } // else if (($bri = &Briskin5::load_data($table_idx)) != FALSE) { - else { + else if ($no_recovery == FALSE) { log_main("ERROR: table ".$table_idx." unrecoverable join"); + + for ($i = 0 ; $i < $table_cur->player_n ; $i++) { + $user_cur = &$this->user[$table_cur->player[$i]]; + $user_cur->subst = "shutdowner"; + $user_cur->step_inc(); + + $ret = sprintf('stat = "%s"; subst = "%s";', $cur_user->stat, $cur_user->subst); + $ret .= "gst.st = ".($user_cur->step+1)."; "; + $ret .= show_notify("
I dati del tavolo n° ".$user_cur->table." sono inconsistenti, verranno resettati.

Torni in piedi.

", 2000, "Chiudi.", 400, 110); + $user_cur->comm[$user_cur->step % COMM_N] = $ret; + $user_cur->step_inc(); + } + + $this->room_join_wakeup(&$user_cur, TRUE, -2); + $table_cur->table_token = ""; } + Briskin5::unlock_data($sem); } // bri::lock_data } // if ($table_cur->player_n == PLAYERS_N) { @@ -907,7 +926,7 @@ class Room { } } - function room_join_wakeup(&$user, $update_lacc = FALSE) + function room_join_wakeup(&$user, $update_lacc = FALSE, $trans_delta) { $table_idx = $user->table; $table = &$this->table[$table_idx]; @@ -974,9 +993,17 @@ class Room { break; // for users that wakeup the room will be reconstructed by index_rd.php - if ($tab_idx < $user_tab_n) - continue; + if ($tab_idx < $user_tab_n) { + log_main("PRE show_room username: ".$user_cur->name." STEP: ".$user_cur->step); + $user_cur->trans_step = $user_cur->step + 1 + $trans_delta; + $user_cur->comm[$user_cur->step % COMM_N] = ""; + $user_cur->step_inc(); + $user_cur->comm[$user_cur->step % COMM_N] = show_room(&$this, ($user_cur->step + 1), &$user_cur); + $user_cur->step_inc(); + log_main("POST show_room username: ".$user_cur->name." STEP: ".$user_cur->step); + continue; + } log_main("JOIN_WAKEUP wup_idx ".$wup_idx." wup_n ".$user_wup_n); log_main("JOIN_WAKEUP more"); @@ -1244,7 +1271,8 @@ class Room { } $this->user[$idx]->name = $name_new; $this->user[$idx]->stat_set("room"); - // MOP $this->user[$idx]->step_set(0); + $this->user[$idx]->step_set(0); + while (array_pop($this->user[$idx]->comm) != NULL); $this->user[$idx]->subst = "standup"; $this->user[$idx]->lacc = $curtime; $this->user[$idx]->laccwr = $curtime; @@ -1292,7 +1320,7 @@ class Room { { GLOBAL $G_false, $sess; - if (($tok = ftok(FTOK_PATH."/main", "B")) == -1) { + if (($tok = @ftok(FTOK_PATH."/main", "B")) == -1) { echo "FTOK FAILED"; exit; } @@ -1334,7 +1362,7 @@ class Room { // var_dump($room); - if (($tok = ftok(FTOK_PATH."/main", "B")) == -1) + if (($tok = @ftok(FTOK_PATH."/main", "B")) == -1) return (FALSE); do { @@ -1365,7 +1393,7 @@ class Room { // echo "LOCK: ".FTOK_PATH."/main"; // exit; - if (($tok = ftok(FTOK_PATH."/main", "B")) == -1) { + if (($tok = @ftok(FTOK_PATH."/main", "B")) == -1) { echo "FTOK FAILED"; exit; } @@ -1580,7 +1608,7 @@ function log_legal($timecur, $sess, $name, $where, $mesg) function lock_banlist() { - if (($tok = ftok(FTOK_PATH."/main", "L")) == -1) { + if (($tok = @ftok(FTOK_PATH."/main", "L")) == -1) { echo "FTOK FAILED"; exit; } @@ -1888,9 +1916,12 @@ function table_wellcome($user) return ($ret); } -function show_room(&$room, &$user) +function show_room(&$room, $user_step, &$user) { - $ret = sprintf('gst.st = %d;', $user->step); + log_main("show_room: username: ".$user->name); + + + $ret = sprintf('gst.st = %d;', $user_step); $ret .= sprintf('stat = "%s";', $user->stat); $ret .= root_wellcome($user);