From bb14689b4a555b4b176192d2c3cd02a4c354a37f Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 31 Mar 2013 09:58:52 +0000 Subject: Introduce a mechanism by which calls to midend_supersede_game_desc() can trigger a call to a front end notification function. Use this to update the game ID permalink when Mines supersedes its game ID. [originally from svn r9793] --- emcc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'emcc.c') diff --git a/emcc.c b/emcc.c index 4116fd1..2a5f788 100644 --- a/emcc.c +++ b/emcc.c @@ -309,6 +309,15 @@ static void update_permalinks(void) sfree(seed); } +/* + * Callback from the midend if Mines supersedes its game description, + * so we can update the permalinks. + */ +static void desc_changed(void *ignored) +{ + update_permalinks(); +} + /* ---------------------------------------------------------------------- * Implementation of the drawing API by calling Javascript canvas * drawing functions. (Well, half of it; the other half is on the JS @@ -762,6 +771,13 @@ int main(int argc, char **argv) } /* + * Request notification if a puzzle (hopefully only ever Mines) + * supersedes its game description, so that we can proactively + * update the permalink. + */ + midend_request_desc_changes(me, desc_changed, NULL); + + /* * Draw the puzzle's initial state, and set up the permalinks and * undo/redo greying out. */ -- cgit v1.1