From e9d542f4385adf118b5c86ad1ef255c84af03e12 Mon Sep 17 00:00:00 2001 From: Timothy Stiles Date: Wed, 14 Oct 2020 22:22:27 +1100 Subject: [PATCH] fix a bug when undoing while waiting for input need to unset it (we used to do this but it got lost in the refactor) --- js/main.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/js/main.js b/js/main.js index da6caea..427f17b 100644 --- a/js/main.js +++ b/js/main.js @@ -428,7 +428,7 @@ class Player extends PrimaryView { while (this.level.undo_stack.length > 0 && ! (moved && this.level.player.slide_mode === null)) { - this.level.undo(); + this.undo(); if (player_cell !== this.level.player.cell) { moved = true; } @@ -843,7 +843,7 @@ class Player extends PrimaryView { } else { // Rewind by undoing one tic every tic - this.level.undo(); + this.undo(); this.update_ui(); } } @@ -862,6 +862,12 @@ class Player extends PrimaryView { this._advance_handle = window.setTimeout(this._advance_bound, dt); } + undo() { + //if we were waiting for input and undo, well, now we're not + this.waiting_for_input = false; + this.level.undo(); + } + // Redraws every frame, unless the game isn't running redraw() { // Calculate this here, not in _redraw, because that's called at weird