Page 1 of 1

Hot seat and Undo

Posted: 20 December 2024, 14:47
by FindYodaWinCash
Hi Folks,

So I've taken advantage of the new hotseat functionality to make sure everything is going smoothly in production.

I use undoRestorePoint(); to implement undo. Whenever the player does this, their turn goes fine, but when the screen comes up for the next player to take their turn, clicking on the "play" button does nothing. It hangs there. F5 fixes this. The screen comes up again and the play button works as normal.

Perhaps I am saving state in the wrong place? I am doing it in stNextPlayer():

Code: Select all

 function stNextPlayer()
    {
        // Active next player
        $player_id = self::activeNextPlayer();
        $players = self::getPlayersWithIDKey();

        if ($players[$player_id]['trainposition'] == NULL) {
                 
            $this->undoSavepoint();
            $this->gamestate->nextState('firstAction');
        } else {
            $this->gamestate->nextState('rollDice');
        }
    }
    
    
Thanks!