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

LibCards/CardStack: Helper to update the cards' disabled flags

This adds a little helper in Cards::CardStack that updates the disabled
flags for its cards depending on a movement rule. It does this by
searching from the bottom up for the last card that is valid. It then
sets the disabled flag for all cards above that card, if it isn't upside
down.
This commit is contained in:
david072 2023-11-12 11:37:52 +01:00 committed by Sam Atkins
parent 55168b50dc
commit 0a806837b5
2 changed files with 55 additions and 0 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2020, Till Mayer <till.mayer@web.de>
* Copyright (c) 2023, David Ganz <david.g.ganz@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -51,6 +52,8 @@ public:
bool is_allowed_to_push(Card const&, size_t stack_size = 1, MovementRule movement_rule = MovementRule::Alternating) const;
ErrorOr<void> add_all_grabbed_cards(Gfx::IntPoint click_location, Vector<NonnullRefPtr<Card>>& grabbed, MovementRule movement_rule = MovementRule::Alternating);
void update_disabled_cards(MovementRule);
bool preview_card(Gfx::IntPoint click_location);
void clear_card_preview();