diff --git a/cockatrice/src/game/board/card_item.h b/cockatrice/src/game/board/card_item.h index 451fed0c6..87f9667de 100644 --- a/cockatrice/src/game/board/card_item.h +++ b/cockatrice/src/game/board/card_item.h @@ -55,6 +55,10 @@ public: CardZoneLogic *_zone = nullptr); void retranslateUi(); + [[nodiscard]] CardState *getState() const + { + return state; + } [[nodiscard]] CardZoneLogic *getZone() const { return state->getZone(); diff --git a/cockatrice/src/game/board/card_state.cpp b/cockatrice/src/game/board/card_state.cpp index fe1aa9b73..4319400d7 100644 --- a/cockatrice/src/game/board/card_state.cpp +++ b/cockatrice/src/game/board/card_state.cpp @@ -18,7 +18,7 @@ void CardState::setZone(CardZoneLogic *_zone) } zone = _zone; - emit zoneChanged(zone); + emit zoneChanged(this, zone); emit stateChanged(); } diff --git a/cockatrice/src/game/board/card_state.h b/cockatrice/src/game/board/card_state.h index ef17f408c..0498b1aa2 100644 --- a/cockatrice/src/game/board/card_state.h +++ b/cockatrice/src/game/board/card_state.h @@ -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) diff --git a/cockatrice/src/game/game_scene.cpp b/cockatrice/src/game/game_scene.cpp index 500c1cbe0..9f466c2ac 100644 --- a/cockatrice/src/game/game_scene.cpp +++ b/cockatrice/src/game/game_scene.cpp @@ -432,7 +432,7 @@ void GameScene::onCardZoneChanged(CardItem *card, bool sameZone) } } for (auto *arrow : toDelete) { - emit requestArrowDeletion(arrow->getId()); + onArrowDeleted(arrow->getId()); } } diff --git a/cockatrice/src/interface/widgets/tabs/tab_game.cpp b/cockatrice/src/interface/widgets/tabs/tab_game.cpp index dd5df72a1..3da3685dd 100644 --- a/cockatrice/src/interface/widgets/tabs/tab_game.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_game.cpp @@ -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(card); + if (cardItem) { + connect(cardItem->getState(), &CardState::zoneChanged, scene, + [this, cardItem]() { scene->onCardZoneChanged(cardItem, false); }); + } } QString TabGame::getTabText() const