[Refactor] Retype card containers and zone logic onto CardState (#7434)

* [Refactor] Retype card containers and zone logic onto CardState

* [Game] Restore attach bookkeeping via CardItem and repaint on state change

* [Refactor] Give custom zones a hidden graphics owner

Custom PileZoneLogic zones had no CardZone, so moving a card into one
left the CardItem drawn at its old spot. Create a hidden PileZone in
onCustomZoneAdded so cards are reparented and hidden.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2026-10-31 18:44:14 +01:00 • committed by GitHub
parent 5d0d466930
commit 65e9f1b370
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 232 additions and 159 deletions

View file

@ -137,7 +137,8 @@ static void selectCardsInZone(
return;
}
for (auto &cardItem : zone->getCards()) {
for (auto *cardState : zone->getCards()) {
auto *cardItem = cardState == nullptr ? nullptr : qobject_cast<CardItem *>(cardState->parent());
if (cardItem && filter(cardItem)) {
cardItem->setSelected(true);
}
@ -596,7 +597,11 @@ void GameScene::addArrow(QSharedPointer<ArrowData> data)
return;
}
CardItem *startCard = startZone->getCard(data->startCardId);
CardState *startCardState = startZone->getCard(data->startCardId);
if (!startCardState) {
return;
}
CardItem *startCard = qobject_cast<CardItem *>(startCardState->parent());
if (!startCard) {
return;
}
@ -607,7 +612,8 @@ void GameScene::addArrow(QSharedPointer<ArrowData> data)
} else {
auto *zone = targetView->getLogic()->getZones().value(data->targetZone);
if (zone) {
targetItem = zone->getCard(data->targetCardId);
CardState *targetCardState = zone->getCard(data->targetCardId);
targetItem = targetCardState == nullptr ? nullptr : qobject_cast<CardItem *>(targetCardState->parent());
}
}
if (!targetItem) {