From 789e11f8f802889904c7eb137d354877f647c88d Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Tue, 31 Jan 2023 21:05:47 +0000 Subject: 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. --- solo.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'solo.c') diff --git a/solo.c b/solo.c index bac19a0..ff98073 100644 --- a/solo.c +++ b/solo.c @@ -5336,13 +5336,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) -{ - if (state->completed) - return false; - return true; -} - static void game_print_size(const game_params *params, float *x, float *y) { int pw, ph; @@ -5661,7 +5654,7 @@ const struct game thegame = { game_status, true, false, game_print_size, game_print, false, /* wants_statusbar */ - false, game_timing_state, + false, NULL, /* timing_state */ REQUIRE_RBUTTON | REQUIRE_NUMPAD, /* flags */ }; -- cgit v1.1