mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-20 16:28:54 +00:00
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.
This commit is contained in:
parent
fc99aa92bd
commit
95401d2ca2
Notes:
sideshowbarker
2024-07-18 17:24:12 +09:00
Author: https://github.com/gunnarbeutner
Commit: 95401d2ca2
Pull-request: https://github.com/SerenityOS/serenity/pull/7443
1 changed files with 4 additions and 0 deletions
|
@ -269,6 +269,7 @@ void Game::timer_event(Core::TimerEvent&)
|
||||||
}
|
}
|
||||||
if (m_animation_current_step >= m_animation_steps) {
|
if (m_animation_current_step >= m_animation_steps) {
|
||||||
stop_timer();
|
stop_timer();
|
||||||
|
m_animation_playing = false;
|
||||||
if (m_animation_did_finish)
|
if (m_animation_did_finish)
|
||||||
(*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()
|
void Game::advance_game()
|
||||||
{
|
{
|
||||||
|
if (m_animation_playing)
|
||||||
|
return;
|
||||||
|
|
||||||
if (m_state == State::Play && game_ended()) {
|
if (m_state == State::Play && game_ended()) {
|
||||||
m_state = State::GameEnded;
|
m_state = State::GameEnded;
|
||||||
on_status_change("Game ended.");
|
on_status_change("Game ended.");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue