mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 00:04:48 -07:00
[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:
parent
90ab663212
commit
b3c89167c5
5 changed files with 12 additions and 3 deletions
|
|
@ -55,6 +55,10 @@ public:
|
|||
CardZoneLogic *_zone = nullptr);
|
||||
|
||||
void retranslateUi();
|
||||
[[nodiscard]] CardState *getState() const
|
||||
{
|
||||
return state;
|
||||
}
|
||||
[[nodiscard]] CardZoneLogic *getZone() const
|
||||
{
|
||||
return state->getZone();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ void CardState::setZone(CardZoneLogic *_zone)
|
|||
}
|
||||
|
||||
zone = _zone;
|
||||
emit zoneChanged(zone);
|
||||
emit zoneChanged(this, zone);
|
||||
emit stateChanged();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ signals:
|
|||
void doesntUntapChanged(bool newValue);
|
||||
void destroyOnZoneChangeChanged(bool newValue);
|
||||
void attachedToChanged(CardItem *newAttachedTo);
|
||||
void zoneChanged(CardZoneLogic *newZone);
|
||||
void zoneChanged(CardState *changedCard, CardZoneLogic *newZone);
|
||||
|
||||
public:
|
||||
explicit CardState(QObject *parent, CardZoneLogic *_zone) : QObject(parent), zone(_zone)
|
||||
|
|
|
|||
|
|
@ -432,7 +432,7 @@ void GameScene::onCardZoneChanged(CardItem *card, bool sameZone)
|
|||
}
|
||||
}
|
||||
for (auto *arrow : toDelete) {
|
||||
emit requestArrowDeletion(arrow->getId());
|
||||
onArrowDeleted(arrow->getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -895,6 +895,11 @@ void TabGame::newCardAdded(AbstractCardItem *card)
|
|||
connect(card, &AbstractCardItem::showCardInfoPopup, this, &TabGame::showCardInfoPopup);
|
||||
connect(card, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString)));
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue