diff options
Diffstat (limited to 'Userland/Games')
-rw-r--r-- | Userland/Games/Spider/Game.cpp | 16 | ||||
-rw-r--r-- | Userland/Games/Spider/Game.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/Userland/Games/Spider/Game.cpp b/Userland/Games/Spider/Game.cpp index 4b003528ef..aa2393b5fa 100644 --- a/Userland/Games/Spider/Game.cpp +++ b/Userland/Games/Spider/Game.cpp @@ -114,6 +114,18 @@ void Game::draw_cards() update(); } +void Game::ensure_top_card_is_visible(NonnullRefPtr<CardStack> stack) +{ + if (stack->is_empty()) + return; + + auto& top_card = stack->peek(); + if (top_card.is_upside_down()) { + top_card.set_upside_down(false); + update(top_card.rect()); + } +} + void Game::detect_full_stacks() { auto& completed_stack = stack(Completed); @@ -143,6 +155,8 @@ void Game::detect_full_stacks() completed_stack.push(current_pile.pop()); } + ensure_top_card_is_visible(current_pile); + update_score(101); } @@ -301,6 +315,8 @@ void Game::mouseup_event(GUI::MouseEvent& event) detect_full_stacks(); + ensure_top_card_is_visible(*m_focused_stack); + rebound = false; break; } diff --git a/Userland/Games/Spider/Game.h b/Userland/Games/Spider/Game.h index 94f48b43c9..cea44a1961 100644 --- a/Userland/Games/Spider/Game.h +++ b/Userland/Games/Spider/Game.h @@ -67,6 +67,7 @@ private: void start_timer_if_necessary(); void update_score(int delta); void draw_cards(); + void ensure_top_card_is_visible(NonnullRefPtr<CardStack> stack); void detect_full_stacks(); void detect_victory(); |