From 418cb3a5671404d2d91bf221887df2be2ae2654f Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Mon, 13 Feb 2023 22:41:40 +0000 Subject: 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. --- devel.but | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'devel.but') diff --git a/devel.but b/devel.but index 6496aef..9ce8eee 100644 --- a/devel.but +++ b/devel.but @@ -885,6 +885,9 @@ user could edit the save file by hand... But if the user is \e{that} determined to cheat, they could just as easily modify the game's source.) +The \cw{encode_ui()} function is optional. If a back-end doesn't need +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); @@ -896,6 +899,9 @@ 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. +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}. + \S{backend-changed-state} \cw{changed_state()} \c void (*changed_state)(game_ui *ui, const game_state *oldstate, -- cgit v1.1