remove all reference operator because with php5 pass by reference is the default...
[brisk.git] / web / Obj / brisk.phh
index 5249ff5..3f65f17 100644 (file)
@@ -134,12 +134,12 @@ $mlang_brisk = array( 'btn_backstand'=> array( 'it' => 'torna in piedi',
 $G_lng = langtolng($G_lang);
 
 $G_all_points = array( 11,10,4,3,2, 0,0,0,0,0 );
-$G_brisk_version = "3.2.0";
+$G_brisk_version = "3.4.2";
 
 /* MLANG: ALL THE INFO STRINGS IN brisk.phh */
-$root_wellarr = array( 'it' => array ( 'Brisk (Ver. '.$G_brisk_version.'), <b>NOVITA\'</b>: informazioni al tavolo sul chiamante, nuovo stato di supporter del sito.',
+$root_wellarr = array( 'it' => array ( 'Brisk (Ver. '.$G_brisk_version.'), <b>NOVITA\'</b>: versione di test per la nuova gestione dei dati volatili.',
                                        'Se vuoi iscriverti alla <a target="_blank" href="mailto:ml-briscola+subscribe@milug.org">Mailing List</a>, cliccala!' ),
-                       'en' => array ( 'Brisk (Ver. '.$G_brisk_version.'), <b>NEWS</b>: caller information on the table, new supporter status.',
+                       'en' => array ( 'Brisk (Ver. '.$G_brisk_version.'), <b>NEWS</b>: test version for the new volatile data management.',
                                        'If you want to subscribe our <a target="_blank" href="ml-briscola+subscribe@milug.org">Mailing List</a>, click it!' ) );
 
 $G_room_help = array( 'it' => '
@@ -393,7 +393,7 @@ class Table {
     $thiz->player_n  =   0;
     $thiz->auth_only =   FALSE;
 
-    $thiz->wag_own   =  NULL;
+    $thiz->wag_own   =  -1;
     $thiz->wag_com   =  "";
     $thiz->wag_tout   =  0;
 
@@ -462,11 +462,11 @@ class Table {
     return ($thiz);
   }
 
-  function wag_set($user, $mesg)
+  function wag_set($user_idx, $mesg)
   {
     log_main("WAG_SET");
 
-    $this->wag_own  =  $user;
+    $this->wag_own  =  $user_idx;
     $this->wag_com  =  $mesg;
     $this->wag_tout =  0;
   }
@@ -476,17 +476,17 @@ class Table {
     log_main("WAG_RESET");
 
     unset($this->wag_own);
-    $this->wag_own = NULL;
+    $this->wag_own  = -1;
     $this->wag_com  = "";
     $this->wag_tout = $timeout;
   }
 
-  function getPlayer($idx)
+  function player_get($idx)
   {
     return ($this->player[$idx]);
   }
 
-  function setPlayer($idx, $player)
+  function player_set($idx, $player)
   {
     $this->player[$idx] = $player;
   }
@@ -1172,7 +1172,7 @@ class Room {
            
            log_rd2("AUTO LOGOUT.");
            if ($user_cur->subst == 'sitdown' || $user_cur->stat == 'table')
-             $this->room_wakeup(&$user_cur);
+             $this->room_wakeup($user_cur);
            else if ($user_cur->subst == 'standup')
              $this->room_outstandup(&$user_cur);
            else
@@ -1182,7 +1182,7 @@ class Room {
 
        if ($user_cur->laccwr + EXPIRE_TIME_SMAMMA < $curtime) { // lo rimettiamo in piedi
          if ($user_cur->stat == 'room' && $user_cur->subst == 'sitdown') {
-           $this->room_wakeup(&$user_cur);
+           $this->room_wakeup($user_cur);
            $user_cur->comm[$user_cur->step % COMM_N] = "gst.st = ".($user_cur->step+1)."; ";
             /* MLANG: <br>Sei stato inattivo per ".(EXPIRE_TIME_SMAMMA/60.0)." minuti. <br><br>Quindi ritorni tra i <b>Giocatori in piedi</b>.", "torna ai tavoli" */
            $user_cur->comm[$user_cur->step % COMM_N] .=  show_notify($mlang_brisk['tabtout_a'][$G_lang].(EXPIRE_TIME_SMAMMA/60.0).$mlang_brisk['tabtout_b'][$G_lang], 0, $mlang_brisk['btn_backstand'][$G_lang], 400, 100);
@@ -1239,8 +1239,8 @@ class Room {
       // $ret .= table_act_content(($user->subst == 'standup'), $this->table[$i]->player_n, $i, $user->table, 
       //                          ($this->table[$i]->auth_only == FALSE ? TRUE : $user->flags & USER_FLAG_AUTH));
       $ret .=  $this->table[$i]->act_content($user);
-      if ($this->table[$i]->wag_own != NULL
-        $ret .= sprintf('tra.add(%d, "%s: %s"); ', $i,  $this->table[$i]->wag_own->name, $this->table[$i]->wag_com);
+      if ($this->table[$i]->wag_own != -1
+        $ret .= sprintf('tra.add(%d, "%s: %s"); ', $i,  $this->user[$this->table[$i]->wag_own]->name, $this->table[$i]->wag_com);
       else 
         $ret .= sprintf('tra.rem(%d); ', $i);
     }
@@ -1250,7 +1250,7 @@ class Room {
   }
   
 
-  function room_wakeup(&$user)
+  function room_wakeup($user)
   {
     $table_idx = $user->table;
     $table = &$this->table[$table_idx];
@@ -1286,11 +1286,10 @@ class Room {
       $user->laccwr = $curtime;
     }
     
-    $remove_wagon = false;
-    if($table->wag_own == $user) {
-      $remove_wagon = true;
+    $remove_wagon = FALSE;
+    if($table->wag_own == $user->idx_get()) {
       $table->wag_reset($curtime);
-      
+      $remove_wagon = TRUE;
     }
     
 
@@ -1298,7 +1297,7 @@ class Room {
     $table->user_rem(&$this, &$user);
 
     for ($i = 0 ; $i < MAX_PLAYERS ; $i++) {
-      $user_cur = &$this->user[$i];
+      $user_cur = $this->user[$i];
       if ($user_cur->sess == '' || $user_cur->stat != 'room')
        continue;
       
@@ -1485,24 +1484,23 @@ class Room {
     log_main("table_update: post");
   }
 
-  function room_sitdown(&$user, $table_idx)
+  function room_sitdown($user, $table_idx)
   {
     log_main("room_sitdown ".($user == FALSE ? "USER: FALSE" : "USER: ".$user->name));
 
     $train_app = "";
 
     if ($table_idx > -1 && $table_idx < TABLES_N) { 
-      $table = &$this->table[$table_idx];
+      $table = $this->table[$table_idx];
 
       // wagon shutdown 
-      if ($table->wag_own != NULL && $table->player_n == PLAYERS_N) {        
+      if ($table->wag_own != -1 && $table->player_n == PLAYERS_N) {        
         for ($i = 0 ; $i < TABLES_N ; $i++) {
-          $user_cur =& $this->user[$table->player[$i]];
-          if ($user_cur == $table->wag_own) {
-            $train_app = sprintf("tra.rem(%d); ", $table_idx); 
-            $table->wag_reset(time());
-            break;
-          }
+            if ($table->wag_own == $table->player[$i]) {
+                $train_app = sprintf("tra.rem(%d); ", $table_idx); 
+                $table->wag_reset(time());
+                break;
+            }
        }
       }
     }
@@ -1538,7 +1536,7 @@ class Room {
     }
   }
 
-  function chatt_send(&$user, $mesg)
+  function chatt_send($user, $mesg)
   {
     GLOBAL $G_base, $G_alarm_passwd, $mlang_brisk, $G_lang;
     $only_you = FALSE;
@@ -1574,7 +1572,7 @@ class Room {
 
         $table = &$this->table[$user->table];
         
-        if ($table->wag_own != NULL) {
+        if ($table->wag_own != -1) {
           // MLANG <br>Il messaggio di segnalazione del tavolo &egrave; gi&agrave; attivato.<br><br> 
           $msg = $mlang_brisk['tickjust'][$G_lang];
           $to_user = show_notify($msg, 0, "chiudi", 400, 100);
@@ -1594,7 +1592,7 @@ class Room {
         
         $msg = substr($msg, 5);
         
-        $table->wag_set($user, $msg);
+        $table->wag_set($user->idx_get(), $msg);
         $to_user = sprintf('tra.add(%d, "%s");', $user->table, xcape(sprintf("%s: %s", $user->name, $msg)));
         $to_room = $to_user;
         /* for old isolation management $is_ticker = TRUE; */
@@ -1857,7 +1855,7 @@ class Room {
 
     if ($to_room != FALSE) {
       for ($i = 0 ; $i < MAX_PLAYERS ; $i++) {
-        $user_cur = &$this->user[$i];
+        $user_cur = $this->user[$i];
         if ($target != "" && $user_cur->name != $target)
           continue;
         //     if ($user_cur->sess == '' || $user_cur->stat != 'room')
@@ -2191,7 +2189,7 @@ class Room {
   function standup_update($user)
   {
     for ($i = 0 ; $i < MAX_PLAYERS ; $i++) {
-      $user_cur = &$this->user[$i];
+      $user_cur = $this->user[$i];
       if ($user_cur->sess == '')
        continue;