aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2023-01-08 21:59:27 +0000
committerBen Harris <bjh21@bjh21.me.uk>2023-01-15 16:24:27 +0000
commit5bd02f982a878312065b4d81d05a90bc41a98c6c (patch)
tree6a4a8182f8bb0b5a67bc4fe29fa369401ba13348
parentd3290195da55beae04d1bb86f811b6f8dd6b0663 (diff)
downloadpuzzles-5bd02f982a878312065b4d81d05a90bc41a98c6c.zip
puzzles-5bd02f982a878312065b4d81d05a90bc41a98c6c.tar.gz
puzzles-5bd02f982a878312065b4d81d05a90bc41a98c6c.tar.bz2
puzzles-5bd02f982a878312065b4d81d05a90bc41a98c6c.tar.xz
Mines: No moving once you're dead!
If a Mines save file contains a move after the player has already died, this can lead to an assertion failure once there are more mines that covered squares. Better to just reject any move after the player's died.
-rw-r--r--mines.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mines.c b/mines.c
index 25b2206..8af7c20 100644
--- a/mines.c
+++ b/mines.c
@@ -2690,6 +2690,9 @@ static game_state *execute_move(const game_state *from, const char *move)
return ret;
} else {
+ /* Dead players should stop trying to move. */
+ if (from->dead)
+ return NULL;
ret = dup_game(from);
while (*move) {