From 2d2d7e8678e55d555554203e3ffec44610bc2c25 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 27 Apr 2021 07:08:08 +0100 Subject: [PATCH] Reinsert some missing screen-clears. I just introduced the 'first_draw' flag in the midend, which should force a screen clear whenever we draw a puzzle with a fresh drawstate. But in fact there were several places where the midend replaces the drawstate and I hadn't set that flag to true. In particular, a user just reported that when you press 'n' for a new game in an existing Magnets window, the new puzzle's clues are drawn, but any old clues in places where the new puzzle doesn't have one is not _un_drawn. (Because Magnets has no code to undraw a single clue - it never needs to!) Added a set of first_draw wherever we call new_drawstate, which should make this reliable again. --- midend.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/midend.c b/midend.c index 0b51c10..4d0aa2c 100644 --- a/midend.c +++ b/midend.c @@ -400,6 +400,7 @@ void midend_force_redraw(midend *me) me->ourgame->free_drawstate(me->drawing, me->drawstate); me->drawstate = me->ourgame->new_drawstate(me->drawing, me->states[0].state); + me->first_draw = true; midend_size_new_drawstate(me); midend_redraw(me); } @@ -539,6 +540,7 @@ void midend_new_game(midend *me) me->statepos = 1; me->drawstate = me->ourgame->new_drawstate(me->drawing, me->states[0].state); + me->first_draw = true; midend_size_new_drawstate(me); me->elapsed = 0.0F; me->flash_pos = me->flash_time = 0.0F; @@ -2340,6 +2342,7 @@ static const char *midend_deserialise_internal( data.states[0].state = me->ourgame->new_game( me, data.cparams, data.privdesc ? data.privdesc : data.desc); + for (i = 1; i < data.nstates; i++) { assert(data.states[i].movetype != NEWGAME); switch (data.states[i].movetype) { @@ -2458,6 +2461,7 @@ static const char *midend_deserialise_internal( me->drawstate = me->ourgame->new_drawstate(me->drawing, me->states[me->statepos-1].state); + me->first_draw = true; midend_size_new_drawstate(me); if (me->game_id_change_notify_function) me->game_id_change_notify_function(me->game_id_change_notify_ctx);