aboutsummaryrefslogtreecommitdiff
path: root/emcc.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2013-03-31 09:58:52 +0000
committerSimon Tatham <anakin@pobox.com>2013-03-31 09:58:52 +0000
commitbb14689b4a555b4b176192d2c3cd02a4c354a37f (patch)
tree6377b0f21fc1c9ba18716f3e4bdb7c07500d018e /emcc.c
parentbf696f83fc8076e748c04a53f425aa29d78c020d (diff)
downloadpuzzles-bb14689b4a555b4b176192d2c3cd02a4c354a37f.zip
puzzles-bb14689b4a555b4b176192d2c3cd02a4c354a37f.tar.gz
puzzles-bb14689b4a555b4b176192d2c3cd02a4c354a37f.tar.bz2
puzzles-bb14689b4a555b4b176192d2c3cd02a4c354a37f.tar.xz
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]
Diffstat (limited to 'emcc.c')
-rw-r--r--emcc.c16
1 files changed, 16 insertions, 0 deletions
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.
*/