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

LibCards+Games: Remove concept of a CardStack being focused

This was only used for asking the stack if it is the one we are moving
cards from. We now have a better way to do that, by comparing against
`CardGame::moving_cards_source_stack()`, which doesn't require manually
telling a stack that it is/isn't focused.
This commit is contained in:
Sam Atkins 2022-09-28 17:47:19 +01:00 committed by Sam Atkins
parent ef8b1e25aa
commit 5186e617bd
3 changed files with 2 additions and 10 deletions

View file

@ -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()) {