mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 14:32:15 -07:00
Fix regressions.
Took 17 minutes Took 9 seconds
This commit is contained in:
parent
040eacee72
commit
0745996cb4
4 changed files with 19 additions and 12 deletions
|
|
@ -53,8 +53,7 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, GameReplay *_replay)
|
|||
gameMetaInfo = new GameMetaInfo();
|
||||
gameState = new GameState(0, -1, -1, _tabSupervisor->getIsLocalGame(), QList<AbstractClient *>(), true, false,
|
||||
false, false, -1, false);
|
||||
connect(gameState, &GameState::playerAdded, this, &TabGame::addPlayer);
|
||||
connect(gameState, &GameState::gameStarted, this, &TabGame::startGame);
|
||||
connectToGameState();
|
||||
|
||||
gameEventHandler = new GameEventHandler(this);
|
||||
connectToGameEventHandler();
|
||||
|
|
@ -101,13 +100,12 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor,
|
|||
gameMetaInfo->setRoomGameTypes(_roomGameTypes);
|
||||
gameState = new GameState(0, event.host_id(), event.player_id(), _tabSupervisor->getIsLocalGame(), _clients,
|
||||
event.spectator(), event.judge(), false, event.resuming(), -1, false);
|
||||
connectToGameState();
|
||||
|
||||
// THIS CTOR IS USED ON GAMES
|
||||
gameMetaInfo->setStarted(false);
|
||||
connect(gameState, &GameState::playerAdded, this, &TabGame::addPlayer);
|
||||
|
||||
connect(gameMetaInfo, &GameMetaInfo::startedChanged, gameState, &GameState::onStartedChanged);
|
||||
connect(gameState, &GameState::gameStarted, this, &TabGame::startGame);
|
||||
|
||||
gameEventHandler = new GameEventHandler(this);
|
||||
connectToGameEventHandler();
|
||||
|
|
@ -146,6 +144,14 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor,
|
|||
QTimer::singleShot(0, this, &TabGame::loadLayout);
|
||||
}
|
||||
|
||||
void TabGame::connectToGameState()
|
||||
{
|
||||
connect(gameState, &GameState::playerAdded, this, &TabGame::addPlayer);
|
||||
connect(gameState, &GameState::gameStarted, this, &TabGame::startGame);
|
||||
connect(gameState, &GameState::activePhaseChanged, this, &TabGame::setActivePhase);
|
||||
connect(gameState, &GameState::activePlayerChanged, this, &TabGame::setActivePlayer);
|
||||
}
|
||||
|
||||
void TabGame::connectToGameEventHandler()
|
||||
{
|
||||
connect(this, &TabGame::gameLeft, gameEventHandler, &GameEventHandler::handleGameLeft);
|
||||
|
|
@ -230,7 +236,7 @@ void TabGame::resetChatAndPhase()
|
|||
messageLog->clearChat();
|
||||
|
||||
// reset phase markers
|
||||
setActivePhase(-1);
|
||||
gameState->setCurrentPhase(-1);
|
||||
}
|
||||
|
||||
void TabGame::emitUserEvent()
|
||||
|
|
@ -826,7 +832,7 @@ Player *TabGame::setActivePlayer(int id)
|
|||
Player *player = gameState->getPlayer(id);
|
||||
if (!player)
|
||||
return nullptr;
|
||||
gameState->setActivePlayer(id);
|
||||
|
||||
playerListWidget->setActivePlayer(id);
|
||||
QMapIterator<int, Player *> i(gameState->getPlayers());
|
||||
while (i.hasNext()) {
|
||||
|
|
@ -848,10 +854,7 @@ Player *TabGame::setActivePlayer(int id)
|
|||
|
||||
void TabGame::setActivePhase(int phase)
|
||||
{
|
||||
if (gameState->getCurrentPhase() != phase) {
|
||||
gameState->setCurrentPhase(phase);
|
||||
phasesToolbar->setActivePhase(phase);
|
||||
}
|
||||
phasesToolbar->setActivePhase(phase);
|
||||
}
|
||||
|
||||
void TabGame::newCardAdded(AbstractCardItem *card)
|
||||
|
|
|
|||
|
|
@ -172,6 +172,7 @@ public:
|
|||
QList<AbstractClient *> &_clients,
|
||||
const Event_GameJoined &event,
|
||||
const QMap<int, QString> &_roomGameTypes);
|
||||
void connectToGameState();
|
||||
void connectToGameEventHandler();
|
||||
void connectMessageLogToGameEventHandler();
|
||||
void connectPlayerListToGameEventHandler();
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@ public:
|
|||
void setActivePlayer(int activePlayerId)
|
||||
{
|
||||
activePlayer = activePlayerId;
|
||||
emit activePlayerChanged(activePlayer);
|
||||
}
|
||||
|
||||
bool getIsLocalGame() const
|
||||
|
|
@ -181,6 +182,7 @@ public:
|
|||
void setCurrentPhase(int phase)
|
||||
{
|
||||
currentPhase = phase;
|
||||
emit activePhaseChanged(phase);
|
||||
}
|
||||
|
||||
bool isMainPlayerConceded() const
|
||||
|
|
@ -224,6 +226,8 @@ signals:
|
|||
void spectatorRemoved(int spectatorId, ServerInfo_User spectator);
|
||||
void gameStarted(bool resuming);
|
||||
void gameStopped();
|
||||
void activePhaseChanged(int activePhase);
|
||||
void activePlayerChanged(int playerId);
|
||||
|
||||
public slots:
|
||||
void incrementGameTime();
|
||||
|
|
|
|||
|
|
@ -805,8 +805,7 @@ void MessageLogWidget::connectToPlayer(Player *player)
|
|||
connect(player, &Player::logAttachCard, this, &MessageLogWidget::logAttachCard);
|
||||
connect(player, &Player::logUnattachCard, this, &MessageLogWidget::logUnattachCard);
|
||||
connect(player, &Player::logDumpZone, this, &MessageLogWidget::logDumpZone);
|
||||
// TODO: Reconnect this
|
||||
// connect(player, &Player::AlogDrawCards, this, &MessageLogWidget::logDrawCards);
|
||||
connect(player, &Player::logDrawCards, this, &MessageLogWidget::logDrawCards);
|
||||
connect(player, &Player::logUndoDraw, this, &MessageLogWidget::logUndoDraw);
|
||||
connect(player, &Player::logRevealCards, this, &MessageLogWidget::logRevealCards);
|
||||
connect(player, &Player::logAlwaysRevealTopCard, this, &MessageLogWidget::logAlwaysRevealTopCard);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue