mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 08:14:47 -07:00
[Game][Arrows] Split Arrows into ArrowData and ArrowItem (#6918)
* [Game][Arrows] Split Arrows into ArrowData and ArrowItem Took 13 minutes Took 5 seconds Took 1 minute Took 26 seconds * Address comments. Took 17 minutes Took 9 seconds Took 1 minute * Change check. Took 3 minutes * Pass by const reference. Took 10 minutes * Remove extra method Took 2 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
bddf9bd818
commit
491d1c9187
15 changed files with 337 additions and 327 deletions
|
|
@ -606,17 +606,9 @@ void TabGame::actNextPhaseAction()
|
|||
|
||||
void TabGame::actRemoveLocalArrows()
|
||||
{
|
||||
QMapIterator<int, PlayerLogic *> playerIterator(game->getPlayerManager()->getPlayers());
|
||||
while (playerIterator.hasNext()) {
|
||||
PlayerLogic *player = playerIterator.next().value();
|
||||
if (!player->getPlayerInfo()->getLocal()) {
|
||||
continue;
|
||||
}
|
||||
QMapIterator<int, ArrowItem *> arrowIterator(player->getArrows());
|
||||
while (arrowIterator.hasNext()) {
|
||||
ArrowItem *a = arrowIterator.next().value();
|
||||
emit arrowDeletionRequested(a->getId());
|
||||
}
|
||||
auto *local = game->getPlayerManager()->getActiveLocalPlayer(game->getGameState()->getActivePlayer());
|
||||
if (local) {
|
||||
scene->clearArrowsForPlayer(local->getPlayerInfo()->getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -970,8 +962,6 @@ void TabGame::createMenuItems()
|
|||
connect(aReverseTurn, &QAction::triggered, game->getGameEventHandler(), &GameEventHandler::handleReverseTurn);
|
||||
aRemoveLocalArrows = new QAction(this);
|
||||
connect(aRemoveLocalArrows, &QAction::triggered, this, &TabGame::actRemoveLocalArrows);
|
||||
connect(this, &TabGame::arrowDeletionRequested, game->getGameEventHandler(),
|
||||
&GameEventHandler::handleArrowDeletion);
|
||||
aRotateViewCW = new QAction(this);
|
||||
connect(aRotateViewCW, &QAction::triggered, this, &TabGame::actRotateViewCW);
|
||||
aRotateViewCCW = new QAction(this);
|
||||
|
|
@ -1155,6 +1145,8 @@ void TabGame::createPlayAreaWidget(bool bReplay)
|
|||
scene = new GameScene(phasesToolbar, this);
|
||||
connect(game->getPlayerManager(), &PlayerManager::playerConceded, scene, &GameScene::rearrange);
|
||||
connect(game->getPlayerManager(), &PlayerManager::playerCountChanged, scene, &GameScene::rearrange);
|
||||
connect(scene, &GameScene::requestArrowDeletion, game->getGameEventHandler(),
|
||||
&GameEventHandler::handleArrowDeletion);
|
||||
gameView = new GameView(scene);
|
||||
|
||||
auto gamePlayAreaVBox = new QVBoxLayout;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue