set turn to -1 while waiting for phonies check

When a guest sends a move to the server it's not the next player's turn
until the server checks the move and rejects or accepts it. It was
possible still to manipulate the board, playing new tiles, and even to
attempt to commit them. And if the move came back rejected, the bogus
committed one would be that was cleared. Bad. So I'm just setting the
turn to -1, which disables board etc., and letting nextTurn() assigne it
after the confirmation comes back.
This commit is contained in:
Eric House 2020-04-18 20:59:15 -07:00
parent 56b1990207
commit 170b9a1ed6

View file

@ -3598,6 +3598,7 @@ finishMove( ServerCtxt* server, TrayTileSet* newTiles, XP_U16 turn )
} else if (isClient && (gi->phoniesAction == PHONIES_DISALLOW)
&& nTilesMoved > 0 ) {
SETSTATE( server, XWSTATE_MOVE_CONFIRM_WAIT );
setTurn( server, -1 );
#endif
} else {
nextTurn( server, PICK_NEXT );
@ -3877,6 +3878,7 @@ handleMoveOk( ServerCtxt* server, XWStreamCtxt* XP_UNUSED(incoming) )
XP_ASSERT( server->nv.gameState == XWSTATE_MOVE_CONFIRM_WAIT );
SETSTATE( server, XWSTATE_INTURN );
setTurn( server, 0 );
nextTurn( server, PICK_NEXT );
return accepted;
@ -4125,6 +4127,7 @@ server_receiveMessage( ServerCtxt* server, XWStreamCtxt* incoming )
case XWPROTO_BADWORD_INFO:
accepted = handleIllegalWord( server, incoming );
if ( accepted && server->nv.gameState != XWSTATE_GAMEOVER ) {
setTurn( server, 0 );
nextTurn( server, PICK_NEXT );
}
break;