From 418cb3a5671404d2d91bf221887df2be2ae2654f Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Mon, 13 Feb 2023 22:41:40 +0000 Subject: Make encode_ui() and decode_ui() optional in back-ends The majority of back-ends define encode_ui() to return NULL and decode_ui() to do nothing. This commit allows them to instead specify the relevant function pointers as NULL, in which case the mid-end won't try to call them. I'm planning to add a parameter to decode_ui(), and if I'm going to have to touch every back-end's version of decode_ui(), I may as well ensure that most of them never need to be touched again. And obviously encode_ui() should go the same way for symmetry. --- lightup.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'lightup.c') diff --git a/lightup.c b/lightup.c index 35705a6..f60017f 100644 --- a/lightup.c +++ b/lightup.c @@ -1848,17 +1848,6 @@ static void free_ui(game_ui *ui) sfree(ui); } -static char *encode_ui(const game_ui *ui) -{ - /* nothing to encode. */ - return NULL; -} - -static void decode_ui(game_ui *ui, const char *encoding) -{ - /* nothing to decode. */ -} - static void game_changed_state(game_ui *ui, const game_state *oldstate, const game_state *newstate) { @@ -2343,8 +2332,8 @@ const struct game thegame = { true, game_can_format_as_text_now, game_text_format, new_ui, free_ui, - encode_ui, - decode_ui, + NULL, /* encode_ui */ + NULL, /* decode_ui */ NULL, /* game_request_keys */ game_changed_state, current_key_label, -- cgit v1.1