1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 12:37:45 +00:00

LibCards+Games: Return ErrorOr from CardStack::add_all_grabbed_cards()

...and CardGame::pick_up_cards_from_stack() which is its only caller.
This commit is contained in:
Sam Atkins 2023-01-20 13:33:30 +00:00 committed by Linus Groh
parent c7c4d70f6e
commit ccabc8e930
6 changed files with 16 additions and 13 deletions

View file

@ -52,10 +52,11 @@ Gfx::IntRect CardGame::moving_cards_bounds() const
return m_moving_cards.first().rect().united(m_moving_cards.last().rect());
}
void CardGame::pick_up_cards_from_stack(Cards::CardStack& stack, Gfx::IntPoint click_location, CardStack::MovementRule movement_rule)
ErrorOr<void> CardGame::pick_up_cards_from_stack(Cards::CardStack& stack, Gfx::IntPoint click_location, CardStack::MovementRule movement_rule)
{
stack.add_all_grabbed_cards(click_location, m_moving_cards, movement_rule);
TRY(stack.add_all_grabbed_cards(click_location, m_moving_cards, movement_rule));
m_moving_cards_source_stack = stack;
return {};
}
RefPtr<CardStack> CardGame::find_stack_to_drop_on(CardStack::MovementRule movement_rule) const