mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-08 11:03:25 -08:00
[Refactor] Retype card containers and zone logic onto CardState
This commit is contained in:
parent
893aeb7bae
commit
f321132cce
32 changed files with 184 additions and 158 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue