Skip to content

Commit

Permalink
Fix timeout to pass correct user id of timed out player.
Browse files Browse the repository at this point in the history
  • Loading branch information
Perlkonig committed Dec 29, 2024
1 parent 7b457df commit 2f31dd7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions api/abstractplay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3437,12 +3437,13 @@ function timeout(userid: string, engine: GameBase|GameBaseSimultaneous, game: Fu
game.winner = engine.winner;
game.numMoves = engine.state().stack.length - 1; // stack has an entry for the board before any moves are made
} else {
const loserid = game.players[loser].id;
const flags = gameinfo.get(game.metaGame).flags;
const simultaneous = flags !== undefined && flags.includes('simultaneous');
if (simultaneous) {
applySimultaneousMove(userid, "timeout", engine as GameBaseSimultaneous, game);
applySimultaneousMove(loserid, "timeout", engine as GameBaseSimultaneous, game);
} else {
applyMove(userid, "timeout", engine, game, flags);
applyMove(loserid, "timeout", engine, game, flags);
}
}
}
Expand Down

0 comments on commit 2f31dd7

Please sign in to comment.