diff --git a/Userland/Games/Spider/Game.cpp b/Userland/Games/Spider/Game.cpp index 6e1dd748d91..af6c65ac47a 100644 --- a/Userland/Games/Spider/Game.cpp +++ b/Userland/Games/Spider/Game.cpp @@ -257,7 +257,7 @@ void Game::mouseup_event(GUI::MouseEvent& event) // This enables the game to move the focused cards to the first possible stack excluding empty stacks. // NOTE: This ignores empty stacks, as the game has no undo button, and a card, which has been moved to an empty stack without any other possibilities is not reversible. for (auto& stack : stacks()) { - if (stack.is_focused()) + if (stack == moving_cards_source_stack()) continue; if (stack.is_allowed_to_push(moving_cards().at(0), moving_cards().size(), Cards::CardStack::MovementRule::Any) && !stack.is_empty()) { diff --git a/Userland/Libraries/LibCards/CardGame.cpp b/Userland/Libraries/LibCards/CardGame.cpp index d2340dfef82..2640dbd2661 100644 --- a/Userland/Libraries/LibCards/CardGame.cpp +++ b/Userland/Libraries/LibCards/CardGame.cpp @@ -45,10 +45,7 @@ Gfx::IntRect CardGame::moving_cards_bounds() const void CardGame::pick_up_cards_from_stack(Cards::CardStack& stack, Gfx::IntPoint click_location, CardStack::MovementRule movement_rule) { - if (m_moving_cards_source_stack) - m_moving_cards_source_stack->set_focused(false); stack.add_all_grabbed_cards(click_location, m_moving_cards, movement_rule); - stack.set_focused(true); m_moving_cards_source_stack = stack; } @@ -60,7 +57,7 @@ RefPtr CardGame::find_stack_to_drop_on(CardStack::MovementRule moveme float closest_distance = FLT_MAX; for (auto const& stack : stacks()) { - if (stack.is_focused()) + if (stack == moving_cards_source_stack()) continue; if (stack.bounding_box().intersects(bounds_to_check) @@ -92,8 +89,6 @@ void CardGame::drop_cards_on_stack(Cards::CardStack& stack, CardStack::MovementR void CardGame::clear_moving_cards() { - if (!m_moving_cards_source_stack.is_null()) - m_moving_cards_source_stack->set_focused(false); m_moving_cards_source_stack.clear(); m_moving_cards.clear(); } diff --git a/Userland/Libraries/LibCards/CardStack.h b/Userland/Libraries/LibCards/CardStack.h index bcde3390297..f821b8a7229 100644 --- a/Userland/Libraries/LibCards/CardStack.h +++ b/Userland/Libraries/LibCards/CardStack.h @@ -34,7 +34,6 @@ public: CardStack(Gfx::IntPoint const& position, Type type, RefPtr covered_stack = nullptr); bool is_empty() const { return m_stack.is_empty(); } - bool is_focused() const { return m_focused; } Type type() const { return m_type; } NonnullRefPtrVector const& stack() const { return m_stack; } size_t count() const { return m_stack.size(); } @@ -42,7 +41,6 @@ public: Card& peek() { return m_stack.last(); } Gfx::IntRect const& bounding_box() const { return m_bounding_box; } - void set_focused(bool focused) { m_focused = focused; } bool make_top_card_visible(); // Returns true if the card was flipped. void push(NonnullRefPtr card); @@ -93,7 +91,6 @@ private: Gfx::IntRect m_bounding_box; Type m_type { Type::Invalid }; StackRules m_rules; - bool m_focused { false }; Gfx::IntRect m_base; };