diff --git a/cockatrice/src/game/game_scene.cpp b/cockatrice/src/game/game_scene.cpp index b2cf92ed1..71b9caa4b 100644 --- a/cockatrice/src/game/game_scene.cpp +++ b/cockatrice/src/game/game_scene.cpp @@ -82,7 +82,6 @@ void GameScene::addPlayer(PlayerLogic *player) { qCInfo(GameScenePlayerAdditionRemovalLog) << "GameScene::addPlayer name=" << player->getPlayerInfo()->getName(); - players << player->getGraphicsItem(); playerViews.insert(player->getPlayerInfo()->getId(), player->getGraphicsItem()); addItem(player->getGraphicsItem()); connect(player->getGraphicsItem(), &PlayerGraphicsItem::sizeChanged, this, &GameScene::rearrange); @@ -122,7 +121,6 @@ void GameScene::removePlayer(PlayerLogic *player) } } auto *view = playerViews.take(player->getPlayerInfo()->getId()); - players.removeOne(view); removeItem(view); rearrange(); } @@ -204,7 +202,7 @@ QList GameScene::collectActivePlayers(int &firstPlayerIndex) cons firstPlayerIndex = 0; bool firstPlayerFound = false; - for (auto *pgItem : players) { + for (auto *pgItem : playerViews.values()) { PlayerLogic *p = pgItem->getPlayer(); if (p && !p->getConceded()) { activePlayers.append(p); @@ -368,7 +366,7 @@ void GameScene::resizeColumnsAndPlayers(const QList &minWidthByColumn, qr } } -void GameScene::onArrowCreateRequested(ArrowData data) +void GameScene::onArrowCreateRequested(const ArrowData &data) { auto *startView = playerViews.value(data.startPlayerId); auto *targetView = playerViews.value(data.targetPlayerId); diff --git a/cockatrice/src/game/game_scene.h b/cockatrice/src/game/game_scene.h index 3dd53e50c..aadbd536e 100644 --- a/cockatrice/src/game/game_scene.h +++ b/cockatrice/src/game/game_scene.h @@ -43,16 +43,15 @@ private: static const int playerAreaSpacing = 5; ///< Space between player areas PhasesToolbar *phasesToolbar; ///< Toolbar showing game phases - QList players; ///< All player graphics items - QMap playerViews; ///< ID lookup + QMap playerViews; ///< ID lookup for player graphics items QList> playersByColumn; ///< Players organized by column - QMap arrowRegistry; - QList zoneViews; ///< Active zone view widgets - QSize viewSize; ///< Current view size - QPointer hoveredCard; ///< Currently hovered card - QBasicTimer *animationTimer; ///< Timer for card animations - QSet cardsToAnimate; ///< Cards currently animating - int playerRotation; ///< Rotation offset for player layout + QMap arrowRegistry; ///< ID registry for arrow graphics items + QList zoneViews; ///< Active zone view widgets + QSize viewSize; ///< Current view size + QPointer hoveredCard; ///< Currently hovered card + QBasicTimer *animationTimer; ///< Timer for card animations + QSet cardsToAnimate; ///< Cards currently animating + int playerRotation; ///< Rotation offset for player layout /** * @brief Updates which card is currently hovered based on scene coordinates. diff --git a/cockatrice/src/game/player/player_logic.h b/cockatrice/src/game/player/player_logic.h index 6b3f34fc2..138ed94ef 100644 --- a/cockatrice/src/game/player/player_logic.h +++ b/cockatrice/src/game/player/player_logic.h @@ -245,12 +245,9 @@ private: int zoneId; QMap zones; QMap counters; - QMap arrows; bool dialogSemaphore; QList cardsToDelete; - - // void eventConnectionStateChanged(const Event_ConnectionStateChanged &event); }; class AnnotationDialog : public QInputDialog