mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Allow repeated "solve" operations in Guess
Since using the "solve" option doesn't consume a guess, it's safe to allow it to occur multiple times. Without this, selecting "solve" a second time causes an assertion failure because solve() returns a move string that's rejected by execute_move(). Possible solve() could instead refuse to solve an already-solved puzzle, but that seems needlessly pedantic. [fixes c84af670b52f09e9e47587584c0559c508d4a37d]
This commit is contained in:
4
guess.c
4
guess.c
@ -946,13 +946,13 @@ static game_state *execute_move(const game_state *from, const char *move)
|
|||||||
game_state *ret;
|
game_state *ret;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
/* No moves are allowed once the game is solved. */
|
|
||||||
if (from->solved) return NULL;
|
|
||||||
if (!strcmp(move, "S")) {
|
if (!strcmp(move, "S")) {
|
||||||
ret = dup_game(from);
|
ret = dup_game(from);
|
||||||
ret->solved = -1;
|
ret->solved = -1;
|
||||||
return ret;
|
return ret;
|
||||||
} else if (move[0] == 'G') {
|
} else if (move[0] == 'G') {
|
||||||
|
/* No guesses are allowed once the game is solved. */
|
||||||
|
if (from->solved) return NULL;
|
||||||
p = move+1;
|
p = move+1;
|
||||||
|
|
||||||
ret = dup_game(from);
|
ret = dup_game(from);
|
||||||
|
Reference in New Issue
Block a user