Solitaire: Remove redundant check and fix formatting mistakes
This commit is contained in:
parent
629036edfe
commit
2af94bbf48
Notes:
sideshowbarker
2024-07-19 08:47:02 +09:00
Author: https://github.com/tlmrgvf Commit: https://github.com/SerenityOS/serenity/commit/2af94bbf48b Pull-request: https://github.com/SerenityOS/serenity/pull/1407 Issue: https://github.com/SerenityOS/serenity/issues/1398
1 changed files with 3 additions and 4 deletions
|
@ -183,7 +183,6 @@ void SolitaireWidget::mousedown_event(GUI::MouseEvent& event)
|
|||
for (auto& to_check : m_stacks) {
|
||||
if (to_check.bounding_box().contains(click_location)) {
|
||||
if (to_check.type() == CardStack::Type::Stock) {
|
||||
|
||||
auto& waste = stack(Waste);
|
||||
auto& stock = stack(Stock);
|
||||
|
||||
|
@ -200,8 +199,9 @@ void SolitaireWidget::mousedown_event(GUI::MouseEvent& event)
|
|||
waste.set_dirty();
|
||||
m_has_to_repaint = true;
|
||||
update_score(-100);
|
||||
} else
|
||||
} else {
|
||||
move_card(stock, waste);
|
||||
}
|
||||
} else if (!to_check.is_empty()) {
|
||||
auto& top_card = to_check.peek();
|
||||
|
||||
|
@ -238,8 +238,7 @@ void SolitaireWidget::mouseup_event(GUI::MouseEvent& event)
|
|||
continue;
|
||||
|
||||
for (auto& focused_card : m_focused_cards) {
|
||||
if (stack.bounding_box().intersects(focused_card.rect())
|
||||
|| stack.bounding_box().contains(event.position())) {
|
||||
if (stack.bounding_box().intersects(focused_card.rect())) {
|
||||
if (stack.is_allowed_to_push(m_focused_cards.at(0))) {
|
||||
for (auto& to_intersect : m_focused_cards) {
|
||||
mark_intersecting_stacks_dirty(to_intersect);
|
||||
|
|
Loading…
Add table
Reference in a new issue