allignment pre merge in master
[brisk.git] / web / briskin5 / index_wr.php
index 1ed5e59..22feb29 100644 (file)
@@ -49,6 +49,8 @@ log_wr('COMM: '.$mesg);
 if ($table_idx < 0 || $table_idx >= TABLE_N)
      exit;
 
+log_mop(0, 'bin::index_wr.php: COMM: '.xcapemesg($mesg));
+
 $sem = Briskin5::lock_data($table_idx);
 
 if (($bri = &Briskin5::load_data($table_idx,$table_token)) == FALSE) {
@@ -67,8 +69,9 @@ if (($user = &$bri->get_user($sess, &$idx)) == FALSE) {
 $argz = explode('|', $mesg);
 
 log_wr('POSTSPLIT: '.$argz[0]);
+log_mop($user->step, 'bin::index_wr.php: after get_user()');
 
-if ($argz[0] == 'shutdown') {
+if (false && $argz[0] == 'shutdown') {
   log_auth($user_cur->sess, "Shutdown session. delegate to room gc the autologout");
   
   log_rd2("bin5/index_wr.php: AUTO LOGOUT.");
@@ -99,6 +102,16 @@ else if ($user->stat == 'table') {
   else if ($argz[0] == 'chatt') {
     $bri->chatt_send(&$user,$mesg);
   }
+  else if ($argz[0] == 'preferences_update') {
+    GLOBAL $CO_bin5_pref_ring_endauct;
+
+    log_wr("PER DI TABLEINFO");
+
+    if ($CO_bin5_pref_ring_endauct == "true")
+      $user->privflags |= BIN5_USER_FLAG_RING_ENDAUCT;
+    else
+      $user->privflags &= ~BIN5_USER_FLAG_RING_ENDAUCT;
+  }
   else if ($argz[0] == 'logout') {
     $remcalc = $argz[1];
 
@@ -155,7 +168,7 @@ else if ($user->stat == 'table') {
     
       log_wr(sprintf("GIOCO FINITO !!!"));
     
-      $table->mult *= 2
+      $table->mult += 1
       $table->old_reason = sprintf("Ha lasciato %s perché aveva al massimo 2 punti.", xcape($user->name));
 
       $table->game_next();
@@ -268,7 +281,7 @@ else if ($user->stat == 'table') {
            log_wr(sprintf("GIOCO FINITO !!!"));
          
            $table->old_reason = "Hanno passato tutti.";
-           $table->mult *= 2
+           $table->mult += 1
 
            $table->game_next();
            $table->game_init(&$bri->user);
@@ -347,6 +360,11 @@ else if ($user->stat == 'table') {
            $user_cur->subst = 'game';
            $ret = sprintf('gst.st = %d; subst = "game";', $user_cur->step+1);
          
+            if ($user_cur->privflags & BIN5_USER_FLAG_RING_ENDAUCT) {
+              // $ret .= "var de_che= 33;";
+              $ret .= playsound("ringbell.mp3");
+            }
+            $ret .= sprintf('document.title = "Brisk - Tavolo %d";', $user->table_orig);
 
            /* bg of caller cell */
            $ret .= briscola_show($bri, $table, $user_cur);
@@ -467,7 +485,8 @@ else if ($user->stat == 'table') {
             $plist .= '|'.xcapelt($user_cur->name).'|'.$pt_cur[$i];
           }
           log_legal($curtime, $user, "STAT:BRISKIN5:FINISH_GAME", $plist);
-          log_points($curtime, $user, "STAT:BRISKIN5:FINISH_GAME", $plist);
+          if ($user->table_orig < TABLES_AUTH_N)
+            log_points($curtime, xcapelt($user->name), "STAT:BRISKIN5:FINISH_GAME", $plist);
 
          $table->game_next();
          $table->game_init(&$bri->user);
@@ -499,6 +518,7 @@ else if ($user->stat == 'table') {
 }
 log_wr("before save data");
 Briskin5::save_data($bri);
+log_mop($user->step, 'bin::index_wr.php: after save_data()');
 
 Briskin5::unlock_data($sem);
 exit;