aboutsummaryrefslogtreecommitdiff
path: root/devel.but
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2023-02-13 23:22:59 +0000
committerBen Harris <bjh21@bjh21.me.uk>2023-04-08 20:08:16 +0100
commit9be7db547aa2eba68492dc3326ea36ebeeb63505 (patch)
tree71cdb91d41dd0f1bc56631d42deae5746cebecc7 /devel.but
parent418cb3a5671404d2d91bf221887df2be2ae2654f (diff)
downloadpuzzles-9be7db547aa2eba68492dc3326ea36ebeeb63505.zip
puzzles-9be7db547aa2eba68492dc3326ea36ebeeb63505.tar.gz
puzzles-9be7db547aa2eba68492dc3326ea36ebeeb63505.tar.bz2
puzzles-9be7db547aa2eba68492dc3326ea36ebeeb63505.tar.xz
Add a game_state argument to decode_ui()
Some games would like a way to check that the parameters in the encoded UI string are consistent with the game parameters. Since this might depend on the current state of the game (this being what changed_state() is for), implement this by adding a game_state parameter to decode_ui(). Nothing currently uses it, though Guess usefully could.
Diffstat (limited to 'devel.but')
-rw-r--r--devel.but7
1 files changed, 5 insertions, 2 deletions
diff --git a/devel.but b/devel.but
index 9ce8eee..ae0a84d 100644
--- a/devel.but
+++ b/devel.but
@@ -890,14 +890,17 @@ this function it can just set the pointer to \cw{NULL}.
\S{backend-decode-ui} \cw{decode_ui()}
-\c void (*decode_ui)(game_ui *ui, const char *encoding);
+\c void (*decode_ui)(game_ui *ui, const char *encoding,
+\c const game_state *state);
This function parses a string previously output by \cw{encode_ui()},
and writes the decoded data back into the freshly-created \c{game_ui}
structure provided. If the string is invalid, the function should do
the best it can, which might just mean not changing the \c{game_ui}
structure at all. This might happen if a save file is corrupted, or
-simply from a newer version that encodes more \c{game_ui} data.
+simply from a newer version that encodes more \c{game_ui} data. The
+current \c{game_state} is provided in case the function needs to
+refer to it for validation.
Like \cw{encode_ui()}, \cw{decode_ui()} is optional. If a back-end
doesn't need this function it can just set the pointer to \cw{NULL}.