mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
Stop the analysis pass in Loopy's redraw routine from being
conditionalised on !ds->started, so that we still do all the looping over everything even if we know it's all going to be redrawn. This is because deciding how much needs redrawing is not the only important thing in those loops - they also set up arrays like ds->clue_error, which tell the individual redraw functions _what_ to draw. Fixes a bug in which, if you start a Loopy game and make moves causing a clue to light up red for an error and then save your game, loading the same save file at the start of a Loopy run would fail to highlight the erroneous clue. (This commit diff looks large, but actually it changes almost nothing but whitespace.) [originally from svn r9751]
This commit is contained in:
99
loopy.c
99
loopy.c
@ -3193,60 +3193,63 @@ static void game_redraw(drawing *dr, game_drawstate *ds, game_state *oldstate,
|
|||||||
* what needs doing, and the second actually does it.
|
* what needs doing, and the second actually does it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!ds->started)
|
if (!ds->started) {
|
||||||
redraw_everything = TRUE;
|
redraw_everything = TRUE;
|
||||||
else {
|
/*
|
||||||
|
* But we must still go through the upcoming loops, so that we
|
||||||
|
* set up stuff in ds correctly for the initial redraw.
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
/* First, trundle through the faces. */
|
/* First, trundle through the faces. */
|
||||||
for (i = 0; i < g->num_faces; i++) {
|
for (i = 0; i < g->num_faces; i++) {
|
||||||
grid_face *f = g->faces + i;
|
grid_face *f = g->faces + i;
|
||||||
int sides = f->order;
|
int sides = f->order;
|
||||||
int clue_mistake;
|
int clue_mistake;
|
||||||
int clue_satisfied;
|
int clue_satisfied;
|
||||||
int n = state->clues[i];
|
int n = state->clues[i];
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
clue_mistake = (face_order(state, i, LINE_YES) > n ||
|
clue_mistake = (face_order(state, i, LINE_YES) > n ||
|
||||||
face_order(state, i, LINE_NO ) > (sides-n));
|
face_order(state, i, LINE_NO ) > (sides-n));
|
||||||
clue_satisfied = (face_order(state, i, LINE_YES) == n &&
|
clue_satisfied = (face_order(state, i, LINE_YES) == n &&
|
||||||
face_order(state, i, LINE_NO ) == (sides-n));
|
face_order(state, i, LINE_NO ) == (sides-n));
|
||||||
|
|
||||||
if (clue_mistake != ds->clue_error[i] ||
|
if (clue_mistake != ds->clue_error[i] ||
|
||||||
clue_satisfied != ds->clue_satisfied[i]) {
|
clue_satisfied != ds->clue_satisfied[i]) {
|
||||||
ds->clue_error[i] = clue_mistake;
|
ds->clue_error[i] = clue_mistake;
|
||||||
ds->clue_satisfied[i] = clue_satisfied;
|
ds->clue_satisfied[i] = clue_satisfied;
|
||||||
if (nfaces == REDRAW_OBJECTS_LIMIT)
|
if (nfaces == REDRAW_OBJECTS_LIMIT)
|
||||||
redraw_everything = TRUE;
|
redraw_everything = TRUE;
|
||||||
else
|
else
|
||||||
faces[nfaces++] = i;
|
faces[nfaces++] = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Work out what the flash state needs to be. */
|
/* Work out what the flash state needs to be. */
|
||||||
if (flashtime > 0 &&
|
if (flashtime > 0 &&
|
||||||
(flashtime <= FLASH_TIME/3 ||
|
(flashtime <= FLASH_TIME/3 ||
|
||||||
flashtime >= FLASH_TIME*2/3)) {
|
flashtime >= FLASH_TIME*2/3)) {
|
||||||
flash_changed = !ds->flashing;
|
flash_changed = !ds->flashing;
|
||||||
ds->flashing = TRUE;
|
ds->flashing = TRUE;
|
||||||
} else {
|
} else {
|
||||||
flash_changed = ds->flashing;
|
flash_changed = ds->flashing;
|
||||||
ds->flashing = FALSE;
|
ds->flashing = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now, trundle through the edges. */
|
/* Now, trundle through the edges. */
|
||||||
for (i = 0; i < g->num_edges; i++) {
|
for (i = 0; i < g->num_edges; i++) {
|
||||||
char new_ds =
|
char new_ds =
|
||||||
state->line_errors[i] ? DS_LINE_ERROR : state->lines[i];
|
state->line_errors[i] ? DS_LINE_ERROR : state->lines[i];
|
||||||
if (new_ds != ds->lines[i] ||
|
if (new_ds != ds->lines[i] ||
|
||||||
(flash_changed && state->lines[i] == LINE_YES)) {
|
(flash_changed && state->lines[i] == LINE_YES)) {
|
||||||
ds->lines[i] = new_ds;
|
ds->lines[i] = new_ds;
|
||||||
if (nedges == REDRAW_OBJECTS_LIMIT)
|
if (nedges == REDRAW_OBJECTS_LIMIT)
|
||||||
redraw_everything = TRUE;
|
redraw_everything = TRUE;
|
||||||
else
|
else
|
||||||
edges[nedges++] = i;
|
edges[nedges++] = i;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pass one is now done. Now we do the actual drawing. */
|
/* Pass one is now done. Now we do the actual drawing. */
|
||||||
|
Reference in New Issue
Block a user