LibCards: Make find_card_stack_to_drop_on() non-const
This function returns a card stack that we might want to drop a card on, so intuitively it should be a mutating function.
This commit is contained in:
parent
df07416171
commit
08a90455ac
Notes:
sideshowbarker
2024-07-16 23:56:50 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/08a90455ac Pull-request: https://github.com/SerenityOS/serenity/pull/17557 Reviewed-by: https://github.com/linusg
2 changed files with 3 additions and 3 deletions
|
@ -59,14 +59,14 @@ ErrorOr<void> CardGame::pick_up_cards_from_stack(Cards::CardStack& stack, Gfx::I
|
|||
return {};
|
||||
}
|
||||
|
||||
RefPtr<CardStack> CardGame::find_stack_to_drop_on(CardStack::MovementRule movement_rule) const
|
||||
RefPtr<CardStack> CardGame::find_stack_to_drop_on(CardStack::MovementRule movement_rule)
|
||||
{
|
||||
auto bounds_to_check = moving_cards_bounds();
|
||||
|
||||
RefPtr<CardStack> closest_stack;
|
||||
float closest_distance = FLT_MAX;
|
||||
|
||||
for (auto const& stack : stacks()) {
|
||||
for (auto& stack : stacks()) {
|
||||
if (stack == moving_cards_source_stack())
|
||||
continue;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
Gfx::IntRect moving_cards_bounds() const;
|
||||
RefPtr<CardStack> moving_cards_source_stack() const { return m_moving_cards_source_stack; }
|
||||
ErrorOr<void> pick_up_cards_from_stack(CardStack&, Gfx::IntPoint click_location, CardStack::MovementRule);
|
||||
RefPtr<CardStack> find_stack_to_drop_on(CardStack::MovementRule) const;
|
||||
RefPtr<CardStack> find_stack_to_drop_on(CardStack::MovementRule);
|
||||
ErrorOr<void> drop_cards_on_stack(CardStack&, CardStack::MovementRule);
|
||||
void clear_moving_cards();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue