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:
Ben Harris
2023-02-13 23:22:59 +00:00
parent 418cb3a567
commit 9be7db547a
8 changed files with 19 additions and 9 deletions

3
net.c
View File

@ -2041,7 +2041,8 @@ static char *encode_ui(const game_ui *ui)
return dupstr(buf);
}
static void decode_ui(game_ui *ui, const char *encoding)
static void decode_ui(game_ui *ui, const char *encoding,
const game_state *state)
{
sscanf(encoding, "O%d,%d;C%d,%d",
&ui->org_x, &ui->org_y, &ui->cx, &ui->cy);