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] --- midend.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'midend.c') diff --git a/midend.c b/midend.c index fddf01d..d55be55 100644 --- a/midend.c +++ b/midend.c @@ -81,6 +81,9 @@ struct midend { int pressed_mouse_button; int preferred_tilesize, tilesize, winwidth, winheight; + + void (*game_desc_change_notify_function)(void *); + void *game_desc_change_notify_ctx; }; #define ensure(me) do { \ @@ -1079,12 +1082,20 @@ int midend_wants_statusbar(midend *me) return me->ourgame->wants_statusbar; } +void midend_request_desc_changes(midend *me, void (*notify)(void *), void *ctx) +{ + me->game_desc_change_notify_function = notify; + me->game_desc_change_notify_ctx = ctx; +} + void midend_supersede_game_desc(midend *me, char *desc, char *privdesc) { sfree(me->desc); sfree(me->privdesc); me->desc = dupstr(desc); me->privdesc = privdesc ? dupstr(privdesc) : NULL; + if (me->game_desc_change_notify_function) + me->game_desc_change_notify_function(me->game_desc_change_notify_ctx); } config_item *midend_get_config(midend *me, int which, char **wintitle) -- cgit v1.1