From eb1ae3f3d041f9ff0c11b04613a695be11bda706 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sat, 28 Jan 2023 18:49:47 +0000 Subject: Forbid moves that fill with the current colour in Flood This avoids an assertion failure, "oldcolour != newcolour" in fill(), by catching it it execute_move(). As far as I know this couldn't be triggered from the UI, but it could be demonstrated with this save file: SAVEFILE:41:Simon Tatham's Portable Puzzle Collection VERSION :1:1 GAME :5:Flood PARAMS :1:3 CPARAMS :1:3 DESC :12:231353400,11 NSTATES :1:3 STATEPOS:1:3 MOVE :2:M3 MOVE :2:M3 --- flood.c | 1 + 1 file changed, 1 insertion(+) diff --git a/flood.c b/flood.c index 1b0fa6e..08410ba 100644 --- a/flood.c +++ b/flood.c @@ -887,6 +887,7 @@ static game_state *execute_move(const game_state *state, const char *move) if (move[0] == 'M' && sscanf(move+1, "%d", &c) == 1 && c >= 0 && + c != state->grid[FILLY * state->w + FILLX] && !state->complete) { int *queue = snewn(state->w * state->h, int); ret = dup_game(state); -- cgit v1.1