mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:37:46 +00:00
Solitaire: Subtract points when undoing a card-flip
Solitaire: Correct default arg definition location
This commit is contained in:
parent
8d8b1d9531
commit
adedb3de2a
2 changed files with 10 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue