chiark / gitweb /
Pegs: clear ui->cur_jumping on undo or redo.
authorSimon Tatham <anakin@pobox.com>
Sun, 10 Feb 2019 14:05:30 +0000 (14:05 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 10 Feb 2019 14:05:30 +0000 (14:05 +0000)
Fixes an assertion failure in which you move the keyboard cursor to a
peg, press Enter to indicate that you're about to jump it to
somewhere, and then instead execute an undo or redo action which
replaces the peg with a hole. Thanks to Vitaly Ostrosablin for the
report.

pegs.c

diff --git a/pegs.c b/pegs.c
index 32673d56e7159ec54e9f13a381c21310c5a37245..db9caf298f28ed098807747ec292615ad8c99834 100644 (file)
--- a/pegs.c
+++ b/pegs.c
@@ -792,6 +792,12 @@ static void game_changed_state(game_ui *ui, const game_state *oldstate,
      * unoccupied.
      */
     ui->dragging = false;
+
+    /*
+     * Also, cancel a keyboard-driven jump if one is half way to being
+     * input.
+     */
+    ui->cur_jumping = false;
 }
 
 #define PREFERRED_TILE_SIZE 33