X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Fbriskin5%2FObj%2Fbriskin5.phh;h=ecc34f66b2fcfa50b410b0d053172ac878fac7e3;hb=bba23fca78d918b22dbb183196da5e93ed5cb141;hp=3eadc14516b53945c31c6dd4ae0813da23c2ca88;hpb=2ec5c3b08cbfdc57ca89d498f3d23090ed9bed51;p=brisk.git diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index 3eadc14..ecc34f6 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -130,7 +130,14 @@ function multoval($mult) function dom_select_rules() { - printf(""); + $ret = "\n"; + + echo "$ret"; } class Card { @@ -174,19 +181,19 @@ class Card { } // end class Card class Bin5_table extends Table { - var $card; // il mazzo di carte - var $mazzo; // chi e' di mazzo - var $gstart; - var $turn; + var $card; // il mazzo di carte + var $mazzo; // chi e' di mazzo + var $gstart; // first player of the current game + var $turn; // turn in the game (absolute, not modularized) - var $asta_pla; - var $asta_pla_n; - var $asta_card; - var $asta_pnt; + var $asta_pla; // array(); TRUE: in auction, FALSE: out of the auction + var $asta_pla_n; // number of players in auction + var $asta_card; // current card for auction + var $asta_pnt; // current point for auction var $mult; - var $points; // points array - var $points_n; // number of row of points + var $points; // points array + var $points_n; // number of row of points var $total; var $asta_win; // the caller idx position at table @@ -651,18 +658,26 @@ class Bin5_table extends Table { do { if ($this->match_id != -1) { + // FIXME_LANG $msg = sprintf("Stai già giocando la partita con codice %d.", $this->match_id); break; } + if ($this->asta_card != -1 || $this->asta_pla_n < BIN5_PLAYERS_N) { + // FIXME_LANG + $msg = sprintf("La partita è già stata avviata."); + break; + } + $rules_id = (int)$rules_id_s; - // FIXME: from dynamic rules list - if ($rules_id != 1 && $rules_id != 2 && $rules_id != 4) { + if (! in_array($rules_id, rules_keys())) { + // FIXME_LANG $msg = "queste regole non esistono o non sono attive"; break; } if ($user->rules_get() == $rules_id) { + // FIXME_LANG $msg = "hai già richiesto di usare queste regole"; break; } @@ -736,13 +751,20 @@ class Bin5_table extends Table { } while (FALSE); $dt = date("H:i ", $curtime); - for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) { - if ($ret == FALSE && $this->player[$i] != $user->idx) - continue; - $user_cur = &$bri->user[$this->player[$i]]; - $user_cur->comm[$user_cur->step % COMM_N] = "gst.st = ".($user_cur->step+1)."; "; - $user_cur->comm[$user_cur->step % COMM_N] .= nickserv_msg($dt, $msg); - $user_cur->step_inc(); + if ($ret == TRUE) { + for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) { + $user_cur = &$bri->user[$this->player[$i]]; + $user_cur->comm[$user_cur->step % COMM_N] = "gst.st = ".($user_cur->step+1)."; "; + $user_cur->comm[$user_cur->step % COMM_N] .= nickserv_msg($dt, $msg); + $user_cur->step_inc(); + } + } + else { + $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; + $user->comm[$user->step % COMM_N] = xcape(sprintf("rules_set(%d);", + $this->rules->id)); + $user->comm[$user->step % COMM_N] .= nickserv_msg($dt, $msg); + $user->step_inc(); } } // end function rules_change } // end class Bin5_table @@ -1583,8 +1605,10 @@ function show_table(&$bri, &$user, $sendstep, $is_transition, $is_again) $ret .= $table->exitlock_show(&$bri->user, $table_pos); if (!$is_again) { /* GENERAL STATUS */ - $ret .= sprintf( 'gst.st = %d; stat = "%s"; subst = "%s"; table_pos = %d;', - $sendstep, $user->stat, $user->subst, $table_pos); + $user_rules = $user->rules_get(); + $ret .= sprintf('gst.st = %d; stat = "%s"; subst = "%s"; table_pos = %d; rules_set(%d);', + $sendstep, $user->stat, $user->subst, $table_pos, + ($user_rules == BIN5_USER_CONTINUE_INIT ? $table->rules->id_get() : $user_rules)); log_rd(sprintf( 'SHOW_TABLE: gst.st = %d; stat = "%s"; subst = "%s"; table_pos = %d;', $sendstep, $user->stat, $user->subst, $table_pos));