From 69f7e7f8f5890946f4625fc071eb3f8313b17238 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Mon, 6 Jun 2005 11:21:36 +0000 Subject: Introduce a new game backend function (there seem to have been a lot of these recently) whose job is to update a game_ui to be consistent with a new game_state. This is called by midend.c in every situation where the current game_state changes _other_ than as a result of make_move (Undo, Redo, Restart, Solve). The introduction of this function allows a game_ui to contain information about selections or highlights within a game_state which simply wouldn't make sense when transferred to another game_state. In particular, I've used it to fix a subtle bug in Solo whereby, although you couldn't right-click to pencil-mode highlight a filled square, you could _get_ a pencil-mode highlight in a filled square if you used Undo and Redo. (Undo to before the square was filled, right-click to highlight it, then Redo. Alternatively, left-click and clear the square, right-click to highlight it, then Undo.) [originally from svn r5912] --- rect.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'rect.c') diff --git a/rect.c b/rect.c index 0448958..c040efa 100644 --- a/rect.c +++ b/rect.c @@ -2183,6 +2183,11 @@ static void ui_draw_rect(game_state *state, game_ui *ui, } } +static void game_changed_state(game_ui *ui, game_state *oldstate, + game_state *newstate) +{ +} + static game_state *make_move(game_state *from, game_ui *ui, game_drawstate *ds, int x, int y, int button) { int xc, yc; @@ -2549,6 +2554,7 @@ const struct game thegame = { TRUE, game_text_format, new_ui, free_ui, + game_changed_state, make_move, game_size, game_colours, -- cgit v1.1