mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 23:51:29 -07:00
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.
This commit is contained in:
@ -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}.
|
||||
|
Reference in New Issue
Block a user