- else if ($argz[0] == 'sitdown') {
- if ($user->stat != 'room' || $user->subst != 'standup') {
- log_wr($sess, "Warning ! sitdown out fsm");
- unlock_data($sem);
- exit;
- }
-
- // Take parameters
- $table_idx = $argz[1];
- $table = &$bri->table[$table_idx];
-
- if ($table->player_n == PLAYERS_N) {
- log_wr($sess, "Warning ! unreachable, table full.");
- unlock_data($sem);
- exit;
- }
-
- // set new status
- $user->subst = "sitdown";
- $user->table = $table_idx;
- $user->table_pos = $table->user_add($idx);
-
- if ($table->player_n == PLAYERS_N) {
- // Start game for this table.
- log_wr($sess, "Start game!");
-
- $table->init(&$bri->user);
- $table->game_init(&$bri->user);
- $curtime = time();
-
- for ($i = 0 ; $i < $table->player_n ; $i++) {
- $user_cur = &$bri->user[$table->player[$i]];
- log_wr($sess, "Pre if!");
-
- $ret = "";
- $ret .= sprintf('gst.st_loc++; gst.st=%d; the_end=true; window.onunload = null ; document.location.assign("table.php");|', $user_cur->step+1);
+ /**********************
+ * *
+ * SUBST: standup *
+ * *
+ **********************/
+ else if ($user->subst == 'standup') {
+
+ if ($argz[0] == 'sitdown') {
+ if ($user->the_end == TRUE) {
+ log_wr($sess, "INFO:SKIP:argz == sitdown && the_end == TRUE => ignore request.");
+ unlock_data($sem);
+ exit;
+ }
+ /* TODO: refact to a function */
+ if ($user->bantime > $user->laccwr) {
+ $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; ";
+ $user->comm[$user->step % COMM_N] .= show_notify("<br>Ti sei alzato da un tavolo senza il consenso degli altri giocatori. Dovrai aspettare ancora ".secstoword($user->bantime - $user->laccwr)." prima di poterti sedere nuovamente.", 2000, "Torna in piedi.", 400, 100);