~mdw
/
sgt
/
puzzles
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow --save to work with --soln, causing saved game files to be
[sgt/puzzles]
/
fifteen.c
diff --git
a/fifteen.c
b/fifteen.c
index
c4b0add
..
5419f41
100644
(file)
--- a/
fifteen.c
+++ b/
fifteen.c
@@
-57,6
+57,11
@@
static game_params *default_params(void)
static int game_fetch_preset(int i, char **name, game_params **params)
{
static int game_fetch_preset(int i, char **name, game_params **params)
{
+ if (i == 0) {
+ *params = default_params();
+ *name = dupstr("4x4");
+ return TRUE;
+ }
return FALSE;
}
return FALSE;
}
@@
-378,6
+383,11
@@
static char *solve_game(game_state *state, game_state *currstate,
return dupstr("S");
}
return dupstr("S");
}
+static int game_can_format_as_text_now(game_params *params)
+{
+ return TRUE;
+}
+
static char *game_text_format(game_state *state)
{
char *ret, *p, buf[80];
static char *game_text_format(game_state *state)
{
char *ret, *p, buf[80];
@@
-820,6
+830,11
@@
static float game_flash_length(game_state *oldstate,
return 0.0F;
}
return 0.0F;
}
+static int game_status(game_state *state)
+{
+ return state->completed ? +1 : 0;
+}
+
static int game_timing_state(game_state *state, game_ui *ui)
{
return TRUE;
static int game_timing_state(game_state *state, game_ui *ui)
{
return TRUE;
@@
-838,7
+853,7
@@
static void game_print(drawing *dr, game_state *state, int tilesize)
#endif
const struct game thegame = {
#endif
const struct game thegame = {
- "Fifteen", "games.fifteen",
+ "Fifteen", "games.fifteen",
"fifteen",
default_params,
game_fetch_preset,
decode_params,
default_params,
game_fetch_preset,
decode_params,
@@
-853,7
+868,7
@@
const struct game thegame = {
dup_game,
free_game,
TRUE, solve_game,
dup_game,
free_game,
TRUE, solve_game,
- TRUE, game_text_format,
+ TRUE, game_
can_format_as_text_now, game_
text_format,
new_ui,
free_ui,
encode_ui,
new_ui,
free_ui,
encode_ui,
@@
-868,6
+883,7
@@
const struct game thegame = {
game_redraw,
game_anim_length,
game_flash_length,
game_redraw,
game_anim_length,
game_flash_length,
+ game_status,
FALSE, FALSE, game_print_size, game_print,
TRUE, /* wants_statusbar */
FALSE, game_timing_state,
FALSE, FALSE, game_print_size, game_print,
TRUE, /* wants_statusbar */
FALSE, game_timing_state,