aboutsummaryrefslogtreecommitdiff
path: root/unfinished
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2023-02-13 22:41:40 +0000
committerBen Harris <bjh21@bjh21.me.uk>2023-04-08 20:08:16 +0100
commit418cb3a5671404d2d91bf221887df2be2ae2654f (patch)
treedd3fe0d67118ca803578708b799aaeab37dc27fd /unfinished
parente411db788cfc0d0ed54b3c9b9deb15edba7d237a (diff)
downloadpuzzles-418cb3a5671404d2d91bf221887df2be2ae2654f.zip
puzzles-418cb3a5671404d2d91bf221887df2be2ae2654f.tar.gz
puzzles-418cb3a5671404d2d91bf221887df2be2ae2654f.tar.bz2
puzzles-418cb3a5671404d2d91bf221887df2be2ae2654f.tar.xz
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.
Diffstat (limited to 'unfinished')
-rw-r--r--unfinished/group.c13
-rw-r--r--unfinished/separate.c13
-rw-r--r--unfinished/slide.c13
-rw-r--r--unfinished/sokoban.c13
4 files changed, 8 insertions, 44 deletions
diff --git a/unfinished/group.c b/unfinished/group.c
index bbac220..7a2ffe6 100644
--- a/unfinished/group.c
+++ b/unfinished/group.c
@@ -1272,15 +1272,6 @@ static void free_ui(game_ui *ui)
sfree(ui);
}
-static char *encode_ui(const game_ui *ui)
-{
- return NULL;
-}
-
-static void decode_ui(game_ui *ui, const char *encoding)
-{
-}
-
static void game_changed_state(game_ui *ui, const game_state *oldstate,
const game_state *newstate)
{
@@ -2332,8 +2323,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,
diff --git a/unfinished/separate.c b/unfinished/separate.c
index d3423de..324a966 100644
--- a/unfinished/separate.c
+++ b/unfinished/separate.c
@@ -705,15 +705,6 @@ static void free_ui(game_ui *ui)
{
}
-static char *encode_ui(const game_ui *ui)
-{
- return NULL;
-}
-
-static void decode_ui(game_ui *ui, const char *encoding)
-{
-}
-
static void game_changed_state(game_ui *ui, const game_state *oldstate,
const game_state *newstate)
{
@@ -845,8 +836,8 @@ const struct game thegame = {
false, 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,
NULL, /* current_key_label */
diff --git a/unfinished/slide.c b/unfinished/slide.c
index 115230f..fe573e8 100644
--- a/unfinished/slide.c
+++ b/unfinished/slide.c
@@ -1217,15 +1217,6 @@ static void free_ui(game_ui *ui)
sfree(ui);
}
-static char *encode_ui(const game_ui *ui)
-{
- return NULL;
-}
-
-static void decode_ui(game_ui *ui, const char *encoding)
-{
-}
-
static void game_changed_state(game_ui *ui, const game_state *oldstate,
const game_state *newstate)
{
@@ -2337,8 +2328,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,
NULL, /* current_key_label */
diff --git a/unfinished/sokoban.c b/unfinished/sokoban.c
index bef7d72..65d1fa6 100644
--- a/unfinished/sokoban.c
+++ b/unfinished/sokoban.c
@@ -927,15 +927,6 @@ static void free_ui(game_ui *ui)
{
}
-static char *encode_ui(const game_ui *ui)
-{
- return NULL;
-}
-
-static void decode_ui(game_ui *ui, const char *encoding)
-{
-}
-
static void game_changed_state(game_ui *ui, const game_state *oldstate,
const game_state *newstate)
{
@@ -1459,8 +1450,8 @@ const struct game thegame = {
false, 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,
NULL, /* current_key_label */