~mdw
/
sgt
/
puzzles
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix default parameter assignment in Light Up when validating an
[sgt/puzzles]
/
lightup.c
diff --git
a/lightup.c
b/lightup.c
index
5b97b2b
..
3747ec1
100644
(file)
--- a/
lightup.c
+++ b/
lightup.c
@@
-215,6
+215,11
@@
static void decode_params(game_params *params, char const *string)
if (*string == 's') {
string++;
EATNUM(params->symm);
if (*string == 's') {
string++;
EATNUM(params->symm);
+ } else {
+ /* cope with user input such as '18x10' by ensuring symmetry
+ * is not selected by default to be incompatible with dimensions */
+ if (params->symm == SYMM_ROT4 && params->w != params->h)
+ params->symm = SYMM_ROT2;
}
params->difficulty = 0;
/* cope with old params */
}
params->difficulty = 0;
/* cope with old params */
@@
-1402,6
+1407,7
@@
static int strip_unused_nums(game_state *state)
}
}
}
}
}
}
+ debug(("Stripped %d unused numbers.\n", n));
return n;
}
return n;
}
@@
-1475,7
+1481,7
@@
static char *new_game_desc(game_params *params, random_state *rs,
char **aux, int interactive)
{
game_state *news = new_state(params), *copys;
char **aux, int interactive)
{
game_state *news = new_state(params), *copys;
- int
nsol,
i, j, run, x, y, wh = params->w*params->h, num;
+ int i, j, run, x, y, wh = params->w*params->h, num;
char *ret, *p;
int *numindices;
char *ret, *p;
int *numindices;
@@
-1499,8
+1505,7
@@
static char *new_game_desc(game_params *params, random_state *rs,
/* Take a copy, remove numbers we didn't use and check there's
* still a unique solution; if so, use the copy subsequently. */
copys = dup_game(news);
/* Take a copy, remove numbers we didn't use and check there's
* still a unique solution; if so, use the copy subsequently. */
copys = dup_game(news);
- nsol = strip_unused_nums(copys);
- debug(("Stripped %d unused numbers.\n", nsol));
+ strip_unused_nums(copys);
if (!puzzle_is_good(copys, params->difficulty)) {
debug(("Stripped grid is not good, reverting.\n"));
free_game(copys);
if (!puzzle_is_good(copys, params->difficulty)) {
debug(("Stripped grid is not good, reverting.\n"));
free_game(copys);
@@
-2160,9
+2165,9
@@
static float game_flash_length(game_state *oldstate, game_state *newstate,
return 0.0F;
}
return 0.0F;
}
-static int game_
is_solved
(game_state *state)
+static int game_
status
(game_state *state)
{
{
- return state->completed;
+ return state->completed
? +1 : 0
;
}
static int game_timing_state(game_state *state, game_ui *ui)
}
static int game_timing_state(game_state *state, game_ui *ui)
@@
-2267,7
+2272,7
@@
const struct game thegame = {
game_redraw,
game_anim_length,
game_flash_length,
game_redraw,
game_anim_length,
game_flash_length,
- game_
is_solved
,
+ game_
status
,
TRUE, FALSE, game_print_size, game_print,
FALSE, /* wants_statusbar */
FALSE, game_timing_state,
TRUE, FALSE, game_print_size, game_print,
FALSE, /* wants_statusbar */
FALSE, game_timing_state,