mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-06 05:23:56 -07:00
Fix properly.
Took 15 minutes
This commit is contained in:
parent
e182cec00a
commit
c049b9f4df
4 changed files with 11 additions and 4 deletions
|
|
@ -93,6 +93,7 @@ void GameScene::addPlayer(PlayerLogic *player)
|
|||
rearrange();
|
||||
});
|
||||
|
||||
connect(player, &PlayerLogic::arrowDeleted, this, &GameScene::onArrowDeleted);
|
||||
connect(player, &PlayerLogic::arrowCreateRequested, this, &GameScene::onArrowCreateRequested);
|
||||
connect(player, &PlayerLogic::arrowDeleteRequested, this, &GameScene::onArrowDeleteRequested);
|
||||
connect(player, &PlayerLogic::arrowsCleared, this,
|
||||
|
|
@ -404,11 +405,17 @@ void GameScene::onArrowCreateRequested(const ArrowData &data)
|
|||
connect(arrow, &QObject::destroyed, this, [this, id = data.id]() { arrowRegistry.remove(id); });
|
||||
}
|
||||
|
||||
void GameScene::onArrowDeleted(int arrowId)
|
||||
{
|
||||
if (arrowRegistry.contains(arrowId)) {
|
||||
arrowRegistry.take(arrowId)->delArrow();
|
||||
}
|
||||
}
|
||||
|
||||
void GameScene::onArrowDeleteRequested(int arrowId)
|
||||
{
|
||||
if (arrowRegistry.contains(arrowId)) {
|
||||
emit requestArrowDeletion(arrowId);
|
||||
arrowRegistry.take(arrowId)->delArrow();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -426,7 +433,6 @@ void GameScene::onCardZoneChanged(CardItem *card, bool sameZone)
|
|||
}
|
||||
for (auto *arrow : toDelete) {
|
||||
emit requestArrowDeletion(arrow->getId());
|
||||
arrowRegistry.take(arrow->getId())->delArrow();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -435,7 +441,6 @@ void GameScene::clearArrowsForPlayer(int playerId)
|
|||
for (auto *arrow : arrowRegistry.values()) {
|
||||
if (arrow->getPlayer()->getPlayerInfo()->getId() == playerId) {
|
||||
emit requestArrowDeletion(arrow->getId());
|
||||
arrowRegistry.take(arrow->getId())->delArrow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,6 +202,7 @@ public slots:
|
|||
QTransform getViewportTransform() const;
|
||||
|
||||
void onArrowCreateRequested(const ArrowData &data);
|
||||
void onArrowDeleted(int arrowId);
|
||||
void onArrowDeleteRequested(int arrowId);
|
||||
void onCardZoneChanged(CardItem *card, bool sameZone);
|
||||
void clearArrowsForPlayer(int playerId);
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ void PlayerEventHandler::eventCreateArrow(const Event_CreateArrow &event)
|
|||
|
||||
void PlayerEventHandler::eventDeleteArrow(const Event_DeleteArrow &event)
|
||||
{
|
||||
emit player->arrowDeleteRequested(event.arrow_id());
|
||||
emit player->arrowDeleted(event.arrow_id());
|
||||
}
|
||||
|
||||
void PlayerEventHandler::eventCreateToken(const Event_CreateToken &event)
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ signals:
|
|||
void resetTopCardMenuActions();
|
||||
void arrowCreateRequested(ArrowData data);
|
||||
void arrowDeleteRequested(int arrowId);
|
||||
void arrowDeleted(int arrowId);
|
||||
void arrowsCleared(); // fires on clear() and processPlayerInfo
|
||||
|
||||
public slots:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue