I am probably overlooking something so trivial that I cannot find any indication of it...
I am working at a game which, when an option is active, has a specific setup state right after the first move. So, the first move is done in the rather usual playerTurn state, then when that option is active, switches to another state (pieSetup) keeping the same player (no next player activation).
The problem I am facing is that, after the state transition, no player is active and no player can perform any move.
This is the definition of the two relevant states (the games has other states but used only later):
This is the code which does the transitions. The code is in ...game.php inside a longish function which manages the AJAX call when the first player does his first move (and which, under all other respects, works fine; the relevant statement is indicated):
The transition does occur when it should and the new state is in effect. From the BGA log:
but, after this, there is no longer an active player. This can be seen from the following facts:
This is haunting me since two or three days. Thanks a lot for any suggestion!
I am working at a game which, when an option is active, has a specific setup state right after the first move. So, the first move is done in the rather usual playerTurn state, then when that option is active, switches to another state (pieSetup) keeping the same player (no next player activation).
The problem I am facing is that, after the state transition, no player is active and no player can perform any move.
This is the definition of the two relevant states (the games has other states but used only later):
Code: Select all
// Player's move
2 => array(
"name" => "playerTurn",
"type" => "activeplayer",
"description" => clienttranslate('${actplayer} has to draw a box side.'),
"descriptionmyturn" => clienttranslate('${you} have to draw a box side.'),
"possibleactions" => array("actDrawSide"),
"transitions" => array("transCompleteBox" => 2, "transSetup" => 3, "transIncompleteBox" => 10, "zombiePass" => 10, "transEndGame" => 99)
),
// First player setup phase, just before pie rule application
3 => array(
"name" => "pieSetup",
"type" => "activePlayer",
"description" => clienttranslate('${actplayer} has to draw a box side or end the setup phase.'),
"descriptionmyturn" => clienttranslate('${you} can draw a box side or end the setup phase.'),
"possibleactions" => array("actDrawSide", "actEndSetup"),
"transitions" => array("transEndSetup" => 4, "transCompleteBox" => 3, "transIncompleteBox" => 3, "zombiePass" => 10)
),
Code: Select all
// decrement the number of available choices and go to `gameEnd` state
// if only as many choices remain as there are unused box sides
if (--$numSel <= $boxesV+1) // no longer any available box side
{
self::debug("Transition `transEndGame`");
$this->gamestate->nextState('transEndGame');
}
// if the table has the pie rule option active, transition to setup state
// and turn pie off
elseif (self::getGameStateValue("has_pie") > 0)
{
self::debug("Transition `transSetup`");
self::setGameStateValue("has_pie", 0);
$this->gamestate->nextState('transSetup'); // <== TRANSITION
}
else
{
self::debug("Transition `trans(In)CompleteBox`");
// otherwise, the game goes on in the same state or into another
// one according to whether boxes have been claimed or not
$this->gamestate->nextState($freeMove ? 'transCompleteBox' : 'transIncompleteBox');
}
Code: Select all
15/06 16:51:52 [info] [T386837] [82.48.72.115] [2353923/Miwarre1] nextState with action: 'transSetup'
15/06 16:51:52 [info] [T386837] [82.48.72.115] [2353923/Miwarre1] jump to state 3
- both players have the state "description" text and neither has the "descriptionmyturn" text;
- neither player can do any move (with message "Not your turn!")
- a couple of log statements to the JS console say:
Code: Select all
Entering state: playerTurn| Active player ID: 2353923 <=== CORRECT
onUpdateActionButtons: pieSetup
Entering state: pieSetup| Active player ID: null <=== NO ACTIVE PLAYER!