Solitaire: Remove redundant check and fix formatting mistakes

This commit is contained in:
Till Mayer 2020-03-10 15:05:25 +01:00 committed by Andreas Kling
parent 629036edfe
commit 2af94bbf48
Notes: sideshowbarker 2024-07-19 08:47:02 +09:00

View file

@ -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);