From 8f87f2ce894f6ba017581abb89e2e0927067bed7 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Fri, 5 Apr 2013 15:49:20 +0000 Subject: I've just realised that the JS puzzles' permalinks were not updating when the user pressed 'n' for a new game, because all the front end knows is that it passed a keystroke to the puzzle, and it has no way of hearing back that a particular keypress resulted in a game id change. To fix this, I've renamed midend_request_desc_changes to midend_request_id_changes and expanded its remit to cover _any_ change to the game ids. So now that callback in the Emscripten front end is the only place from which update_permalinks is called (apart from initialising them at setup time), and that should handle everything. [originally from svn r9805] --- devel.but | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'devel.but') diff --git a/devel.but b/devel.but index 5fb200d..d2bf2e4 100644 --- a/devel.but +++ b/devel.but @@ -1609,10 +1609,6 @@ should use it if they're not Mines; if you think you need to use it, think again repeatedly in the hope of finding a better way to do whatever it was you needed to do. -If a front end wants to be notified when this happens, it can ask the -midend to do so by calling \cw{midend_request_desc_changes()}; see -\k{midend-request-desc-changes}. - \C{drawing} The drawing API The back end function \cw{redraw()} (\k{backend-redraw}) is required @@ -3274,17 +3270,18 @@ message (which does not need freeing at all). accept or return a pointer to a midend. You'd probably call it just \e{before} deciding what kind of midend you wanted to instantiate.) -\H{midend-request-desc-changes} \cw{midend_request_desc_changes()} +\H{midend-request-id-changes} \cw{midend_request_id_changes()} -\c void midend_request_desc_changes(midend *me, -\c void (*notify)(void *), void *ctx); +\c void midend_request_id_changes(midend *me, +\c void (*notify)(void *), void *ctx); This function is called by the front end to request notification by -the mid-end when a puzzle supersedes its game description (see -\k{backend-supersede}). After this function is called, any call to -\cw{midend_supersede_game_desc()} by the back end will cause the -mid-end to call \cw{notify(ctx)} after the game description is -changed. +the mid-end when the current game IDs (either descriptive or +random-seed) change. This can occur as a result of keypresses ('n' for +New Game, for example) or when a puzzle supersedes its game +description (see \k{backend-supersede}). After this function is +called, any change of the game ids will cause the mid-end to call +\cw{notify(ctx)} after the change. This is for use by puzzles which want to present the game description to the user constantly (e.g. as an HTML hyperlink) instead of only -- cgit v1.1