diff options
Diffstat (limited to 'Userland/Games/Solitaire/Game.cpp')
-rw-r--r-- | Userland/Games/Solitaire/Game.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Userland/Games/Solitaire/Game.cpp b/Userland/Games/Solitaire/Game.cpp index 0b7a4c86e5..35a034bc12 100644 --- a/Userland/Games/Solitaire/Game.cpp +++ b/Userland/Games/Solitaire/Game.cpp @@ -139,7 +139,7 @@ void Game::start_timer_if_necessary() } } -void Game::score_move(CardStack& from, CardStack& to, bool inverse = false) +void Game::score_move(CardStack& from, CardStack& to, bool inverse) { if (from.type() == CardStack::Type::Play && to.type() == CardStack::Type::Normal) { update_score(5 * (inverse ? -1 : 1)); @@ -152,6 +152,11 @@ void Game::score_move(CardStack& from, CardStack& to, bool inverse = false) } } +void Game::score_flip(bool inverse) +{ + update_score(5 * (inverse ? -1 : 1)); +} + void Game::update_score(int to_add) { m_score = max(static_cast<int>(m_score) + to_add, 0); @@ -200,7 +205,7 @@ void Game::mousedown_event(GUI::MouseEvent& event) if (top_card.is_upside_down()) { if (top_card.rect().contains(click_location)) { top_card.set_upside_down(false); - update_score(5); + score_flip(); update(top_card.rect()); remember_flip_for_undo(top_card); } @@ -600,6 +605,7 @@ void Game::perform_undo() if (on_undo_availability_change) on_undo_availability_change(false); invalidate_layout(); + score_flip(true); return; } |