aboutsummaryrefslogtreecommitdiff
path: root/net.c
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 /net.c
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 'net.c')
-rw-r--r--net.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net.c b/net.c
index 7f90047..d920c5c 100644
--- a/net.c
+++ b/net.c
@@ -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);