X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fbrisk.phh;h=e3dd54b9fe9c90be0ead0a28b99fa3728cc30fbc;hb=6a6c26cd9a2ba2f3782116c69c017dd3c50c864e;hp=94976009e4d5c90f0b18300d70ffca3c747dc092;hpb=b804ca474cbf9e02703043b2d6e41cf52c9889ed;p=brisk.git diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 9497600..e3dd54b 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -2,7 +2,7 @@ /* * brisk - brisk.phh * - * Copyright (C) 2006-2007 matteo.nastasi@milug.org + * Copyright (C) 2006-2008 matteo.nastasi@milug.org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ define(SHM_DIMS_MIN, (50000 + 10000 * TABLES_N + 15000 * MAX_PLAYERS)); define(SHM_DIMS_MAX, SHM_DIMS_MIN + 1048576); define(SHM_DIMS_DLT, 65536); -define(COMM_N, 12); +define(COMM_N, 18); define(COMM_GEN_N, 50); define(SESS_LEN, 13); define(STREAM_TIMEOUT, 20); @@ -51,6 +51,7 @@ define(DBG_LOCK, 0x0040); define(DBG_WRIT, 0x0080); define(DBG_LOAD, 0x0100); define(DBG_AUTH, 0x0200); +define(DBG_CRIT, 0x0400); define(BRISK_DEBUG, 0); @@ -61,9 +62,9 @@ define(BRISK_SINGLE_SESS, ""); $G_false = FALSE; $G_all_points = array( 11,10,4,3,2, 0,0,0,0,0 ); -$G_brisk_version = "spawn-0.9.3"; +$G_brisk_version = "spawn-0.10.4"; -$root_wellarr = Array ( 'Benvenuto in brisk (Ver. '.$G_brisk_version.'), NOVITA\': dimensionamento dinamico dell\'area dati e ottimizzazione della stessa, versione beta.', +$root_wellarr = Array ( 'Benvenuto in brisk (Ver. '.$G_brisk_version.'), NOVITA\': dimensionamento dinamico dell\'area dati e ottimizzazione della stessa, versione beta2.', '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.'); @@ -642,6 +643,16 @@ class User { return (FALSE); } + + function reset() { + $tmp_sess = $this->sess; + $this->sess = ""; + step_unproxy($tmp_sess); + $this->name = ""; + while (array_pop($this->comm) != NULL); + $this->step = 0; + $this->the_end = FALSE; + } } // end class User @@ -777,14 +788,14 @@ class Room { } } // else if (($bri = &Briskin5::load_data($table_idx)) != FALSE) { else if ($no_recovery == FALSE) { - log_main("ERROR: table ".$table_idx." unrecoverable join"); + log_crit("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 = sprintf('stat = "%s"; subst = "%s";', $user_cur->stat, $user_cur->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; @@ -817,12 +828,16 @@ class Room { if ($user_cur->stat == 'table' || $user_cur->stat == 'room') { log_auth($user_cur->sess, "Autologout session."); + $user_cur->reset(); + /* factorized with ->reset() $tmp_sess = $user_cur->sess; $user_cur->sess = ""; step_unproxy($tmp_sess); $user_cur->name = ""; + while (array_pop($user_cur->comm) != NULL); $user_cur->step = 0; $user_cur->the_end = FALSE; + */ log_rd2("AUTO LOGOUT."); if ($user_cur->subst == 'sitdown' || $user_cur->stat == 'table') @@ -1004,7 +1019,9 @@ class Room { if ($tab_idx < $user_tab_n) { log_main("PRE show_room username: ".$user_cur->name." STEP: ".$user_cur->step); - while (array_pop($user_cur->comm) != NULL); +// ARRAY_POP DISABLED +// if ($trans_delta == 0) +// while (array_pop($user_cur->comm) != NULL); $user_cur->trans_step = $user_cur->step + 1 + $trans_delta; $user_cur->comm[$user_cur->step % COMM_N] = ""; @@ -1471,6 +1488,26 @@ function log_only2($log) { } } +function log_crit($log) { + GLOBAL $sess; + + if (BRISK_SINGLE_SESS == "" && (BRISK_DEBUG & DBG_CRIT) == 0) + return; + + if (isset($sess) == FALSE) + $ssess = "XXXX"; + else + $ssess = $sess; + + if (( (BRISK_DEBUG | ($ssess == BRISK_SINGLE_SESS ? BRISK_SINGLE_DEBUG : 0) ) & DBG_CRIT) == 0) + return; + + if (($fp = @fopen(LEGAL_PATH."/brisk.log", 'a')) != FALSE) { + fwrite($fp, sprintf("CRIT: [%s] [%s]\n", $ssess, $log)); + fclose($fp); + } +} + function log_only($log) { GLOBAL $sess;