diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2021-05-25 08:32:01 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-25 21:05:35 +0200 |
commit | fc99aa92bdcf9d0709a50a010828b922a860eed6 (patch) | |
tree | f78ca934a8f493f5b00725da2348a8275a3782c7 /Userland/Games | |
parent | 87ace131bcf1191027ce8c871dd9d197c38953c4 (diff) | |
download | serenity-fc99aa92bdcf9d0709a50a010828b922a860eed6.zip |
Hearts: Fix animations that get stuck "mid-flight"
When an animation is stopped the cards should be moved to their final
position anyway. Otherwise they might end up getting stuck in the
middle of the animation.
Diffstat (limited to 'Userland/Games')
-rw-r--r-- | Userland/Games/Hearts/Game.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Games/Hearts/Game.cpp b/Userland/Games/Hearts/Game.cpp index 328361679b..b9c05bbc31 100644 --- a/Userland/Games/Hearts/Game.cpp +++ b/Userland/Games/Hearts/Game.cpp @@ -251,7 +251,11 @@ void Game::start_animation(NonnullRefPtrVector<Card> cards, Gfx::IntPoint const& void Game::stop_animation() { - m_animation_playing = false; + if (m_animation_playing) { + for (auto& animation : m_animation_cards) + animation.card->set_position(m_animation_end); + m_animation_playing = false; + } if (m_animation_delay_timer) m_animation_delay_timer->stop(); stop_timer(); |