From dd216087aa0a846fe9bdb2c547d3e5b109efacc4 Mon Sep 17 00:00:00 2001 From: simon Date: Tue, 11 May 2004 18:37:20 +0000 Subject: [PATCH] Don't rush move animation to a conclusion on a subsequent keypress unless there's actual activity happening as a result of the move. Net animations were tending to get rushed to conclusion by the mouse button release now that it's being reported to the mid-end. git-svn-id: svn://svn.tartarus.org/sgt/puzzles@4211 cda61777-01e9-0310-a592-d414129be87e --- midend.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/midend.c b/midend.c index a2aee45..63ba193 100644 --- a/midend.c +++ b/midend.c @@ -158,29 +158,36 @@ static void midend_finish_move(midend_data *me) activate_timer(me->frontend); } -int midend_process_key(midend_data *me, int x, int y, int button) +static void midend_stop_anim(midend_data *me) { - game_state *oldstate = dup_game(me->states[me->statepos - 1]); - float anim_time; - if (me->oldstate || me->anim_time) { midend_finish_move(me); midend_redraw(me); } +} + +int midend_process_key(midend_data *me, int x, int y, int button) +{ + game_state *oldstate = dup_game(me->states[me->statepos - 1]); + float anim_time; if (button == 'n' || button == 'N' || button == '\x0E') { + midend_stop_anim(me); midend_new_game(me); midend_redraw(me); return 1; /* never animate */ } else if (button == 'r' || button == 'R') { + midend_stop_anim(me); midend_restart_game(me); midend_redraw(me); return 1; /* never animate */ } else if (button == 'u' || button == 'u' || button == '\x1A' || button == '\x1F') { + midend_stop_anim(me); if (!midend_undo(me)) return 1; } else if (button == '\x12') { + midend_stop_anim(me); if (!midend_redo(me)) return 1; } else if (button == 'q' || button == 'Q' || button == '\x11') { @@ -199,6 +206,7 @@ int midend_process_key(midend_data *me, int x, int y, int button) midend_redraw(me); return 1; } else if (s) { + midend_stop_anim(me); while (me->nstates > me->statepos) free_game(me->states[--me->nstates]); ensure(me); -- 2.11.0