1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

Code review tweaks

This commit is contained in:
nordsoft
2022-10-13 00:18:15 +04:00
parent 2645843d4f
commit 297f518eb0
2 changed files with 11 additions and 9 deletions

View File

@@ -138,7 +138,7 @@ public:
std::map<PlayerColor, std::shared_ptr<CBattleGameInterface>> battleints;
std::map<PlayerColor, std::vector<std::shared_ptr<IBattleEventsReceiver>>> additionalBattleInts;
boost::optional<BattleAction> curbaction;
CClient();

View File

@@ -347,6 +347,14 @@ void PlayerEndsGame::applyCl(CClient *cl)
void PlayerReinitInterface::applyCl(CClient * cl)
{
auto initInterfaces = [cl]()
{
cl->initPlayerInterfaces();
auto currentPlayer = cl->gameState()->currentPlayer;
callAllInterfaces(cl, &IGameEventsReceiver::playerStartsTurn, currentPlayer);
callOnlyThatInterface(cl, currentPlayer, &CGameInterface::yourTurn);
};
for(auto player : players)
{
auto & plSettings = CSH->si->getIthPlayersSettings(player);
@@ -354,19 +362,13 @@ void PlayerReinitInterface::applyCl(CClient * cl)
{
plSettings.connectedPlayerIDs.clear();
cl->initPlayerEnvironments();
cl->initPlayerInterfaces();
auto currentPlayer = cl->gameState()->currentPlayer;
callAllInterfaces(cl, &IGameEventsReceiver::playerStartsTurn, currentPlayer);
callOnlyThatInterface(cl, currentPlayer, &CGameInterface::yourTurn);
initInterfaces();
}
else if(playerConnectionId == CSH->c->connectionID)
{
plSettings.connectedPlayerIDs.insert(playerConnectionId);
cl->playerint.clear();
cl->initPlayerInterfaces();
auto currentPlayer = cl->gameState()->currentPlayer;
callAllInterfaces(cl, &IGameEventsReceiver::playerStartsTurn, currentPlayer);
callOnlyThatInterface(cl, currentPlayer, &CGameInterface::yourTurn);
initInterfaces();
}
}
}