mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-22 08:25:45 -07:00
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]
This commit is contained in:
16
emcc.c
16
emcc.c
@ -313,10 +313,10 @@ static void update_permalinks(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Callback from the midend if Mines supersedes its game description,
|
||||
* so we can update the permalinks.
|
||||
* Callback from the midend when the game ids change, so we can update
|
||||
* the permalinks.
|
||||
*/
|
||||
static void desc_changed(void *ignored)
|
||||
static void ids_changed(void *ignored)
|
||||
{
|
||||
update_permalinks();
|
||||
}
|
||||
@ -598,7 +598,6 @@ static void cfg_end(int use_results)
|
||||
midend_new_game(me);
|
||||
resize();
|
||||
midend_redraw(me);
|
||||
update_permalinks();
|
||||
free_cfg(cfg);
|
||||
js_dialog_cleanup();
|
||||
}
|
||||
@ -653,7 +652,6 @@ void command(int n)
|
||||
*/
|
||||
midend_set_params(me, presets[i]);
|
||||
midend_new_game(me);
|
||||
update_permalinks();
|
||||
resize();
|
||||
midend_redraw(me);
|
||||
update_undo_redo();
|
||||
@ -802,11 +800,11 @@ 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.
|
||||
* Request notification when the game ids change (e.g. if the user
|
||||
* presses 'n', and also when Mines supersedes its game
|
||||
* description), so that we can proactively update the permalink.
|
||||
*/
|
||||
midend_request_desc_changes(me, desc_changed, NULL);
|
||||
midend_request_id_changes(me, ids_changed, NULL);
|
||||
|
||||
/*
|
||||
* Draw the puzzle's initial state, and set up the permalinks and
|
||||
|
Reference in New Issue
Block a user