+ //
+ // START THE SPAWN HERE!!!!
+ //
+
+ $curtime = time();
+
+ // Create new spawned table
+ $bri_sem = Briskin5::lock_data($table_idx);
+ $table_token = uniqid("");
+ $room->table[$table_idx]->table_token = $table_token;
+ $room->table[$table_idx]->table_start = $curtime;
+
+ $plist = "$table_token|$user->table|$table->player_n";
+ for ($i = 0 ; $i < $table->player_n ; $i++) {
+ $plist .= '|'.$room->user[$table->player[$i]]->sess;
+ }
+ log_legal($curtime, $user, "STAT:CREATE_GAME", $plist);
+
+ if (($bri =& new Briskin5(&$room, $table_idx, $table_token)) == FALSE)
+ log_wr("bri create: FALSE");
+ else
+ log_wr("bri create: ".serialize($bri));
+
+ // init table
+ $bri_table =& $bri->table[0];
+ $bri_table->init(&$bri->user);
+ $bri_table->game_init(&$bri->user);
+ //
+ // Init spawned users.
+ //
+ require_once('briskin5/Obj/briskin5.phh');
+ //
+ // MULTIGAME: here init of selected game instead of hardcabled briskin5 init (look subst status)
+ //
+ for ($i = 0 ; $i < $table->player_n ; $i++) {
+ $bri_user_cur = &$bri->user[$i];
+ $user_cur = &$room->user[$table->player[$i]];
+
+ $bri_user_cur->stat_set('table');
+ $bri_user_cur->subst = 'asta';
+ $bri_user_cur->laccwr = $curtime;
+
+ $bri_user_cur->trans_step = $user_cur->step + 1;
+ $bri_user_cur->comm[$bri_user_cur->step % COMM_N] = "";
+ $bri_user_cur->step_inc();
+ $bri_user_cur->comm[$bri_user_cur->step % COMM_N] = show_table(&$bri,&$bri_user_cur,$bri_user_cur->step+1,TRUE, FALSE);
+
+ $bri_user_cur->step_inc();
+
+ log_wr("TRY PRESAVE: ".$bri_user_cur->step." TRANS STEP: ".$bri_user_cur->trans_step);
+
+ log_wr("Pre if!");
+
+ // ARRAY_POP DISABLED
+ // // CHECK
+ while (array_pop($user_cur->comm) != NULL);
+
+ $ret = "";
+ $ret .= sprintf('gst.st_loc++; gst.st=%d; createCookie("table_idx", %d, 24*365, cookiepath); createCookie("table_token", "%s", 24*365, cookiepath); createCookie("lang", "%s", 24*365, cookiepath); the_end=true; window.onunload = null ; window.onbeforeunload = null ; document.location.assign("briskin5/index.php");|', $user_cur->step+1, $table_idx, $table_token, $G_lang);
+
+ $user_cur->comm[$user_cur->step % COMM_N] = $ret;
+ $user_cur->trans_step = $user_cur->step + 1;
+ log_wr("TRANS ATTIVATO");
+
+
+ $user_cur->stat_set('table');
+ $user_cur->subst = 'asta';
+ $user_cur->laccwr = $curtime;
+ $user_cur->step_inc();
+ }
+ log_wr("presave bri");
+ Briskin5::save_data($bri);
+ Briskin5::unlock_data($bri_sem);
+ log_wr("postsave bri");