chiark / gitweb /
End victory flash on new game and restart game.
authorJonas Kölker <jonaskoelker@yahoo.com>
Thu, 8 Oct 2015 09:00:29 +0000 (11:00 +0200)
committerSimon Tatham <anakin@pobox.com>
Wed, 14 Oct 2015 19:29:32 +0000 (20:29 +0100)
Net provides the best demonstration of why. Complete a game of net,
then press N while the victory flash is playing: then the victory
flash keeps playing on the new game board. (Tip: save a game which
but for a redo is completed, then you can reproduce this repeatedly
without having to complete a new game each time.)

The flash timer reset code is placed together with the animation
timer reset code, because the two are conceptually related. Note
that midend_restart_game resets animations via midend_finish_move.

midend.c

index c8ab76c43b682bd5638eb389ea50b527d7d65dc8..190840af62531cdc08de4f8c642c474327aff7c6 100644 (file)
--- a/midend.c
+++ b/midend.c
@@ -454,6 +454,7 @@ void midend_new_game(midend *me)
                                               me->states[0].state);
     midend_size_new_drawstate(me);
     me->elapsed = 0.0F;
+    me->flash_pos = me->flash_time = 0.0F;
     me->anim_pos = me->anim_time = 0.0F;
     if (me->ui)
         me->ourgame->free_ui(me->ui);
@@ -575,6 +576,7 @@ void midend_restart_game(midend *me)
         me->ourgame->changed_state(me->ui,
                                    me->states[me->statepos-2].state,
                                    me->states[me->statepos-1].state);
+    me->flash_pos = me->flash_time = 0.0F;
     midend_finish_move(me);
     midend_redraw(me);
     midend_set_timer(me);