From 95401d2ca2dae9d08ead3c8fd17077910c1f8e54 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 25 May 2021 08:56:54 +0200 Subject: [PATCH] Hearts: Don't advance the game's state when an animation is playing Previously we'd end up cancelling an animation that was still playing when the user selects a card. --- Userland/Games/Hearts/Game.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Games/Hearts/Game.cpp b/Userland/Games/Hearts/Game.cpp index b9c05bbc31..3c921e9d0b 100644 --- a/Userland/Games/Hearts/Game.cpp +++ b/Userland/Games/Hearts/Game.cpp @@ -269,6 +269,7 @@ void Game::timer_event(Core::TimerEvent&) } if (m_animation_current_step >= m_animation_steps) { stop_timer(); + m_animation_playing = false; if (m_animation_did_finish) (*m_animation_did_finish)(); } @@ -398,6 +399,9 @@ void Game::continue_game_after_delay(int interval_ms) void Game::advance_game() { + if (m_animation_playing) + return; + if (m_state == State::Play && game_ended()) { m_state = State::GameEnded; on_status_change("Game ended.");