[Game][Arrows] Hook up to the state zone change properly. (#6937)

Took 17 minutes

Took 3 seconds

Took 2 minutes

Took 10 minutes

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2026-05-25 08:19:27 +02:00 committed by GitHub
parent 90ab663212
commit b3c89167c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 12 additions and 3 deletions

View file

@ -55,6 +55,10 @@ public:
CardZoneLogic *_zone = nullptr); CardZoneLogic *_zone = nullptr);
void retranslateUi(); void retranslateUi();
[[nodiscard]] CardState *getState() const
{
return state;
}
[[nodiscard]] CardZoneLogic *getZone() const [[nodiscard]] CardZoneLogic *getZone() const
{ {
return state->getZone(); return state->getZone();

View file

@ -18,7 +18,7 @@ void CardState::setZone(CardZoneLogic *_zone)
} }
zone = _zone; zone = _zone;
emit zoneChanged(zone); emit zoneChanged(this, zone);
emit stateChanged(); emit stateChanged();
} }

View file

@ -31,7 +31,7 @@ signals:
void doesntUntapChanged(bool newValue); void doesntUntapChanged(bool newValue);
void destroyOnZoneChangeChanged(bool newValue); void destroyOnZoneChangeChanged(bool newValue);
void attachedToChanged(CardItem *newAttachedTo); void attachedToChanged(CardItem *newAttachedTo);
void zoneChanged(CardZoneLogic *newZone); void zoneChanged(CardState *changedCard, CardZoneLogic *newZone);
public: public:
explicit CardState(QObject *parent, CardZoneLogic *_zone) : QObject(parent), zone(_zone) explicit CardState(QObject *parent, CardZoneLogic *_zone) : QObject(parent), zone(_zone)

View file

@ -432,7 +432,7 @@ void GameScene::onCardZoneChanged(CardItem *card, bool sameZone)
} }
} }
for (auto *arrow : toDelete) { for (auto *arrow : toDelete) {
emit requestArrowDeletion(arrow->getId()); onArrowDeleted(arrow->getId());
} }
} }

View file

@ -895,6 +895,11 @@ void TabGame::newCardAdded(AbstractCardItem *card)
connect(card, &AbstractCardItem::showCardInfoPopup, this, &TabGame::showCardInfoPopup); connect(card, &AbstractCardItem::showCardInfoPopup, this, &TabGame::showCardInfoPopup);
connect(card, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString))); connect(card, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString)));
connect(card, &AbstractCardItem::cardShiftClicked, this, &TabGame::linkCardToChat); connect(card, &AbstractCardItem::cardShiftClicked, this, &TabGame::linkCardToChat);
CardItem *cardItem = qobject_cast<CardItem *>(card);
if (cardItem) {
connect(cardItem->getState(), &CardState::zoneChanged, scene,
[this, cardItem]() { scene->onCardZoneChanged(cardItem, false); });
}
} }
QString TabGame::getTabText() const QString TabGame::getTabText() const