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)
This commit is contained in:
Timothy Stiles 2020-10-14 22:22:27 +11:00
parent a7c38ae0af
commit e9d542f438

View File

@ -428,7 +428,7 @@ class Player extends PrimaryView {
while (this.level.undo_stack.length > 0 && while (this.level.undo_stack.length > 0 &&
! (moved && this.level.player.slide_mode === null)) ! (moved && this.level.player.slide_mode === null))
{ {
this.level.undo(); this.undo();
if (player_cell !== this.level.player.cell) { if (player_cell !== this.level.player.cell) {
moved = true; moved = true;
} }
@ -843,7 +843,7 @@ class Player extends PrimaryView {
} }
else { else {
// Rewind by undoing one tic every tic // Rewind by undoing one tic every tic
this.level.undo(); this.undo();
this.update_ui(); this.update_ui();
} }
} }
@ -862,6 +862,12 @@ class Player extends PrimaryView {
this._advance_handle = window.setTimeout(this._advance_bound, dt); 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 // Redraws every frame, unless the game isn't running
redraw() { redraw() {
// Calculate this here, not in _redraw, because that's called at weird // Calculate this here, not in _redraw, because that's called at weird