diff --git a/Userland/Games/Solitaire/Game.cpp b/Userland/Games/Solitaire/Game.cpp index 7394bfd3e5..37eea9886a 100644 --- a/Userland/Games/Solitaire/Game.cpp +++ b/Userland/Games/Solitaire/Game.cpp @@ -521,16 +521,6 @@ void Game::auto_move_eligible_cards_to_foundations() auto_move_eligible_cards_to_foundations(); } -void Game::mark_intersecting_stacks_dirty(Card& intersecting_card) -{ - for (auto& stack : stacks()) { - if (intersecting_card.rect().intersects(stack.bounding_box())) - update(stack.bounding_box()); - } - - update(intersecting_card.rect()); -} - void Game::paint_event(GUI::PaintEvent& event) { Gfx::Color background_color = this->background_color(); diff --git a/Userland/Games/Solitaire/Game.h b/Userland/Games/Solitaire/Game.h index f36a9ed3f1..1e3c359e43 100644 --- a/Userland/Games/Solitaire/Game.h +++ b/Userland/Games/Solitaire/Game.h @@ -159,7 +159,6 @@ private: } } - void mark_intersecting_stacks_dirty(Card& intersecting_card); void score_move(CardStack& from, CardStack& to, bool inverse = false); void score_flip(bool inverse = false); void remember_move_for_undo(CardStack& from, CardStack& to, NonnullRefPtrVector moved_cards); diff --git a/Userland/Games/Spider/Game.cpp b/Userland/Games/Spider/Game.cpp index b525802bac..e8f5a91340 100644 --- a/Userland/Games/Spider/Game.cpp +++ b/Userland/Games/Spider/Game.cpp @@ -105,16 +105,6 @@ void Game::draw_cards() start_timer(s_timer_interval_ms); } -void Game::mark_intersecting_stacks_dirty(Card& intersecting_card) -{ - for (auto& stack : stacks()) { - if (intersecting_card.rect().intersects(stack.bounding_box())) - update(stack.bounding_box()); - } - - update(intersecting_card.rect()); -} - void Game::detect_full_stacks() { auto& completed_stack = stack_at_location(Completed); diff --git a/Userland/Games/Spider/Game.h b/Userland/Games/Spider/Game.h index ed7f26766e..9c3e870942 100644 --- a/Userland/Games/Spider/Game.h +++ b/Userland/Games/Spider/Game.h @@ -70,7 +70,6 @@ private: void start_timer_if_necessary(); void update_score(int delta); void draw_cards(); - void mark_intersecting_stacks_dirty(Card& intersecting_card); void detect_full_stacks(); void detect_victory(); void move_focused_cards(CardStack& stack); diff --git a/Userland/Libraries/LibCards/Card.h b/Userland/Libraries/LibCards/Card.h index 8a18e5d90d..b5a01325eb 100644 --- a/Userland/Libraries/LibCards/Card.h +++ b/Userland/Libraries/LibCards/Card.h @@ -88,6 +88,7 @@ public: virtual ~Card() override = default; Gfx::IntRect& rect() { return m_rect; } + Gfx::IntRect const& rect() const { return m_rect; } Gfx::IntPoint position() const { return m_rect.location(); } Gfx::IntPoint const& old_position() const { return m_old_position; } Rank rank() const { return m_rank; }; diff --git a/Userland/Libraries/LibCards/CardGame.cpp b/Userland/Libraries/LibCards/CardGame.cpp index 216dffbf2a..6917da40ab 100644 --- a/Userland/Libraries/LibCards/CardGame.cpp +++ b/Userland/Libraries/LibCards/CardGame.cpp @@ -22,6 +22,16 @@ void CardGame::add_stack(NonnullRefPtr stack) m_stacks.append(move(stack)); } +void CardGame::mark_intersecting_stacks_dirty(Cards::Card const& intersecting_card) +{ + for (auto& stack : stacks()) { + if (intersecting_card.rect().intersects(stack.bounding_box())) + update(stack.bounding_box()); + } + + update(intersecting_card.rect()); +} + void CardGame::dump_layout() const { dbgln("------------------------------"); diff --git a/Userland/Libraries/LibCards/CardGame.h b/Userland/Libraries/LibCards/CardGame.h index 8d9ca0e4fd..87e8a5a940 100644 --- a/Userland/Libraries/LibCards/CardGame.h +++ b/Userland/Libraries/LibCards/CardGame.h @@ -25,6 +25,7 @@ public: NonnullRefPtrVector const& stacks() const { return m_stacks; } CardStack& stack_at_location(int location) { return m_stacks[location]; } void add_stack(NonnullRefPtr); + void mark_intersecting_stacks_dirty(Card const& intersecting_card); void dump_layout() const;