added 'continue' field to Bin5_user class
[brisk.git] / web / briskin5 / Obj / briskin5.phh
index 9701af9..211678a 100644 (file)
@@ -407,6 +407,7 @@ class Bin5_table extends Table {
         for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) {
             $this->total[$i] = 0;
             $user_cur = $userarr[$this->player[$i]];
+            $user_cur->stat_set('table');
             $user_cur->exitislock = TRUE;
         }
 
@@ -497,7 +498,7 @@ class Bin5_table extends Table {
         return ($ct);
     }
 
-    function rules_engine($bri, $curtime, $action, $user)
+    function rules_engine(&$bri, $curtime, $action, $user)
     {
         GLOBAL $G_all_points, $G_dbasetype;
 
@@ -654,7 +655,8 @@ class Bin5_table extends Table {
 
 
 define('BIN5_USER_FLAG_RING_ENDAUCT', 0x01);
-
+define('BIN5_USER_CONTINUE_INIT', -1);
+define('BIN5_USER_CONTINUE_ALREADY', -2);
 class Bin5_user extends User {
     var $asta_card;  //
     var $asta_pnt;   //
@@ -662,6 +664,8 @@ class Bin5_user extends User {
     var $exitislock; // Player can exit from the table ?
     var $privflags;  // Flags for briskin5 only
 
+    var $continue;   // Id of the match that the user would continue
+
     const BASE = "../";
 
     function User() {
@@ -677,6 +681,7 @@ class Bin5_user extends User {
        $thiz->handpt = -1;
        $thiz->exitislock = TRUE;
        $thiz->privflags = 0;
+       $thiz->continue = BIN5_USER_CONTINUE_INIT;
 
        return ($thiz);
        }
@@ -696,6 +701,7 @@ class Bin5_user extends User {
         $this->handpt     = $from->handpt;
         $this->exitislock = $from->exitislock;
         $this->privflags  = $from->privflags;
+        $this->continue   = $from->continue;
     }
 
     /* CLONE NOT USED
@@ -724,11 +730,13 @@ class Bin5_user extends User {
         /* NOTE: at this moment idx and table_pos fields have the same value
            but diffentent functions, we keep them separated for a while */
         $thiz->room       = $bri;
-        $thiz->idx        = $table_pos;
+        $thiz->idx        = $table_pos; // it is the position in the mini-room,
+                                        // not related to table pos (see below)
         $thiz->asta_card  = -2;
         $thiz->asta_pnt   = -1;
         $thiz->handpt     = -1;
         $thiz->exitislock = TRUE;
+        $thiz->continue   = BIN5_USER_CONTINUE_INIT;
 
         log_wr("Bin5 constructor");
 
@@ -945,6 +953,12 @@ class Bin5_user extends User {
                   }
                   for ($i = $cur_step ; $i < $this->step ; $i++) {
                       $ii = $i % COMM_N;
+                      if ($this->comm[$ii] == "") {
+                          if ($i == $cur_step)
+                              continue;
+                          else
+                              break;
+                      }
                       log_rd2("ADDED TO THE STREAM: ".$this->comm[$ii]);
                       $ret .= $this->comm[$ii];
                   }
@@ -981,17 +995,20 @@ class Bin5_user extends User {
 
 
       return ($ret);
-  }  //   function maincheck (...
-
-
-
+    }  //   function maincheck (...
 
+    function continue_set($match_code)
+    {
+        $this->continue = $match_code;
+    }
 
+    function continue_get() {
+        return ($this->continue);
+    }
 
 } // end class Bin5_user
 
 
-
 class Bin5 {
     static $delta_t = array();