mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 23:51:29 -07:00
Remove various unused game functions
If can_configure is false, then the game's configure() and custom_params() functions will never be called. If can_solve is false, solve() will never be called. If can_format_as_text_ever is false, can_format_as_text_now() and text_format() will never be called. If can_print is false, print_size() and print() will never be called. If is_timed is false, timing_state() will never be called. In each case, almost all puzzles provided a function nonetheless. I think this is because in Puzzles' early history there was no "game" structure, so the functions had to be present for linking to work. But now that everything indirects through the "game" structure, unused functions can be left unimplemented and the corresponding pointers set to NULL. So now where the flags mentioned above are false, the corresponding functions are omitted and the function pointers in the "game" structures are NULL.
This commit is contained in:
29
netslide.c
29
netslide.c
@ -893,16 +893,6 @@ static char *solve_game(const game_state *state, const game_state *currstate,
|
||||
return dupstr(aux);
|
||||
}
|
||||
|
||||
static bool game_can_format_as_text_now(const game_params *params)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static char *game_text_format(const game_state *state)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Utility routine.
|
||||
*/
|
||||
@ -1852,19 +1842,6 @@ static int game_status(const game_state *state)
|
||||
return state->completed ? +1 : 0;
|
||||
}
|
||||
|
||||
static bool game_timing_state(const game_state *state, game_ui *ui)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static void game_print_size(const game_params *params, float *x, float *y)
|
||||
{
|
||||
}
|
||||
|
||||
static void game_print(drawing *dr, const game_state *state, int tilesize)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef COMBINED
|
||||
#define thegame netslide
|
||||
#endif
|
||||
@ -1885,7 +1862,7 @@ const struct game thegame = {
|
||||
dup_game,
|
||||
free_game,
|
||||
true, solve_game,
|
||||
false, game_can_format_as_text_now, game_text_format,
|
||||
false, NULL, NULL, /* can_format_as_text_now, text_format */
|
||||
new_ui,
|
||||
free_ui,
|
||||
encode_ui,
|
||||
@ -1904,9 +1881,9 @@ const struct game thegame = {
|
||||
game_flash_length,
|
||||
game_get_cursor_location,
|
||||
game_status,
|
||||
false, false, game_print_size, game_print,
|
||||
false, false, NULL, NULL, /* print_size, print */
|
||||
true, /* wants_statusbar */
|
||||
false, game_timing_state,
|
||||
false, NULL, /* timing_state */
|
||||
0, /* flags */
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user