mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:47:37 +00:00
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
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 {};
|
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();
|
auto bounds_to_check = moving_cards_bounds();
|
||||||
|
|
||||||
RefPtr<CardStack> closest_stack;
|
RefPtr<CardStack> closest_stack;
|
||||||
float closest_distance = FLT_MAX;
|
float closest_distance = FLT_MAX;
|
||||||
|
|
||||||
for (auto const& stack : stacks()) {
|
for (auto& stack : stacks()) {
|
||||||
if (stack == moving_cards_source_stack())
|
if (stack == moving_cards_source_stack())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
Gfx::IntRect moving_cards_bounds() const;
|
Gfx::IntRect moving_cards_bounds() const;
|
||||||
RefPtr<CardStack> moving_cards_source_stack() const { return m_moving_cards_source_stack; }
|
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);
|
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);
|
ErrorOr<void> drop_cards_on_stack(CardStack&, CardStack::MovementRule);
|
||||||
void clear_moving_cards();
|
void clear_moving_cards();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue