mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-05 21:13:55 -07:00
Clear arrows locally in special circumstances i.e. teardown.
Took 28 minutes
This commit is contained in:
parent
6c57258c66
commit
9953f88b26
4 changed files with 13 additions and 5 deletions
|
|
@ -96,8 +96,8 @@ void GameScene::addPlayer(PlayerLogic *player)
|
|||
connect(player, &PlayerLogic::arrowDeleted, this, &GameScene::deleteArrow);
|
||||
connect(player, &PlayerLogic::arrowCreateRequested, this, &GameScene::addArrow);
|
||||
connect(player, &PlayerLogic::arrowDeleteRequested, this, &GameScene::requestArrowDeletion);
|
||||
connect(player, &PlayerLogic::arrowsCleared, this,
|
||||
[this, id = player->getPlayerInfo()->getId()]() { clearArrowsForPlayer(id); });
|
||||
connect(player, &PlayerLogic::arrowsClearedLocally, this,
|
||||
[this, id = player->getPlayerInfo()->getId()]() { clearArrowsForPlayerLocally(id); });
|
||||
|
||||
connect(player->getPlayerEventHandler(), &PlayerEventHandler::cardZoneChanged, this, &GameScene::onCardZoneChanged);
|
||||
|
||||
|
|
@ -441,6 +441,13 @@ void GameScene::clearArrowsForPlayer(int playerId)
|
|||
}
|
||||
}
|
||||
|
||||
void GameScene::clearArrowsForPlayerLocally(int playerId)
|
||||
{
|
||||
for (int arrowId : arrowRegistry.idsForPlayer(playerId)) {
|
||||
arrowRegistry.take(playerId, arrowId)->delArrow();
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- Hover Handling ----------
|
||||
|
||||
void GameScene::updateHover(const QPointF &scenePos)
|
||||
|
|
|
|||
|
|
@ -206,6 +206,7 @@ public slots:
|
|||
void addArrow(QSharedPointer<ArrowData> data);
|
||||
void deleteArrow(int playerId, int arrowId);
|
||||
void clearArrowsForPlayer(int playerId);
|
||||
void clearArrowsForPlayerLocally(int playerId);
|
||||
|
||||
/// Queues up arrow deletion but doesn't directly modify the scene
|
||||
void requestArrowDeletion(int playerId, int arrowId);
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ PlayerLogic::~PlayerLogic()
|
|||
|
||||
void PlayerLogic::clear()
|
||||
{
|
||||
emit arrowsCleared();
|
||||
emit arrowsClearedLocally();
|
||||
|
||||
QMapIterator<QString, CardZoneLogic *> i(zones);
|
||||
while (i.hasNext()) {
|
||||
|
|
@ -115,7 +115,7 @@ void PlayerLogic::processPlayerInfo(const ServerInfo_Player &info)
|
|||
/* HandZone */
|
||||
ZoneNames::HAND};
|
||||
clearCounters();
|
||||
emit arrowsCleared();
|
||||
emit arrowsClearedLocally();
|
||||
|
||||
QMutableMapIterator<QString, CardZoneLogic *> zoneIt(zones);
|
||||
while (zoneIt.hasNext()) {
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ signals:
|
|||
void arrowCreateRequested(QSharedPointer<ArrowData> data);
|
||||
void arrowDeleteRequested(int creatorId, int arrowId);
|
||||
void arrowDeleted(int creatorId, int arrowId);
|
||||
void arrowsCleared(); // fires on clear() and processPlayerInfo
|
||||
void arrowsClearedLocally(); // fires on clear() and processPlayerInfo
|
||||
|
||||
public slots:
|
||||
void setActive(bool _active);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue