mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
solve_game() is passed the _initial_ game state, not the most recent
one; so we can't just set `ret->completed = ret->movecount' and hope it's been set to something other than zero. Instead, we set both move counts to 1, which is entirely arbitrary but works. This fixes a subtle bug with the Solve feature: if you pressed Solve, then disturbed the grid, then brought it back to the solved state by making more forward moves (rather than using Undo), then the first time you did this the `Moves since auto-solve' status line would reset to zero. [originally from svn r5759]
This commit is contained in:
@ -398,7 +398,7 @@ static game_state *solve_game(game_state *state, game_aux_info *aux,
|
||||
ret->tiles[i] = (i+1) % ret->n;
|
||||
ret->gap_pos = ret->n-1;
|
||||
ret->used_solve = ret->just_used_solve = TRUE;
|
||||
ret->completed = ret->movecount;
|
||||
ret->completed = ret->movecount = 1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -805,7 +805,7 @@ static game_state *solve_game(game_state *state, game_aux_info *aux,
|
||||
ret = dup_game(state);
|
||||
memcpy(ret->tiles, state->solution->tiles, ret->width * ret->height);
|
||||
ret->used_solve = ret->just_used_solve = TRUE;
|
||||
ret->completed = ret->move_count;
|
||||
ret->completed = ret->move_count = 1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ static game_state *solve_game(game_state *state, game_aux_info *aux,
|
||||
for (i = 0; i < ret->n; i++)
|
||||
ret->tiles[i] = i+1;
|
||||
ret->used_solve = ret->just_used_solve = TRUE;
|
||||
ret->completed = ret->movecount;
|
||||
ret->completed = ret->movecount = 1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user