aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2005-05-07 16:07:26 +0000
committerSimon Tatham <anakin@pobox.com>2005-05-07 16:07:26 +0000
commit751d7a25244d2b62352b57e298c409a8a419bcb2 (patch)
tree349344595a9ce835aabfa7bb3a8edd7725338b26
parent6336dbf208078af6eef51669510e885a91ca64b8 (diff)
downloadpuzzles-751d7a25244d2b62352b57e298c409a8a419bcb2.zip
puzzles-751d7a25244d2b62352b57e298c409a8a419bcb2.tar.gz
puzzles-751d7a25244d2b62352b57e298c409a8a419bcb2.tar.bz2
puzzles-751d7a25244d2b62352b57e298c409a8a419bcb2.tar.xz
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]
-rw-r--r--fifteen.c2
-rw-r--r--netslide.c2
-rw-r--r--sixteen.c2
-rw-r--r--twiddle.c2
4 files changed, 4 insertions, 4 deletions
diff --git a/fifteen.c b/fifteen.c
index 0ed5067..3aba7fa 100644
--- a/fifteen.c
+++ b/fifteen.c
@@ -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;
}
diff --git a/netslide.c b/netslide.c
index f367621..02fa438 100644
--- a/netslide.c
+++ b/netslide.c
@@ -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;
}
diff --git a/sixteen.c b/sixteen.c
index 950f724..3a5ce8a 100644
--- a/sixteen.c
+++ b/sixteen.c
@@ -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;
}
diff --git a/twiddle.c b/twiddle.c
index 8fd0b21..6c51cb7 100644
--- a/twiddle.c
+++ b/twiddle.c
@@ -492,7 +492,7 @@ static game_state *solve_game(game_state *state, game_aux_info *aux,
for (i = 0; i < ret->w*ret->h; i++)
ret->grid[i] &= ~3;
ret->used_solve = ret->just_used_solve = TRUE;
- ret->completed = ret->movecount;
+ ret->completed = ret->movecount = 1;
return ret;
}