1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Code review tweaks

This commit is contained in:
nordsoft
2022-10-08 19:52:29 +04:00
parent 64a801004c
commit 63b29cbaea
2 changed files with 41 additions and 41 deletions

View File

@@ -466,24 +466,26 @@ void CVCMIServer::clientConnected(std::shared_ptr<CConnection> c, std::vector<st
logNetwork->info("Connection with client %d established. UUID: %s", c->connectionID, c->uuid);
if(state == EServerState::LOBBY)
for(auto & name : names)
{
logNetwork->info("Client %d player: %s", c->connectionID, name);
ui8 id = currentPlayerId++;
ClientPlayer cp;
cp.connection = c->connectionID;
cp.name = name;
playerNames.insert(std::make_pair(id, cp));
announceTxt(boost::str(boost::format("%s (pid %d cid %d) joins the game") % name % id % c->connectionID));
//put new player in first slot with AI
for(auto & elem : si->playerInfos)
for(auto & name : names)
{
if(elem.second.isControlledByAI() && !elem.second.compOnly)
logNetwork->info("Client %d player: %s", c->connectionID, name);
ui8 id = currentPlayerId++;
ClientPlayer cp;
cp.connection = c->connectionID;
cp.name = name;
playerNames.insert(std::make_pair(id, cp));
announceTxt(boost::str(boost::format("%s (pid %d cid %d) joins the game") % name % id % c->connectionID));
//put new player in first slot with AI
for(auto & elem : si->playerInfos)
{
setPlayerConnectedId(elem.second, id);
break;
if(elem.second.isControlledByAI() && !elem.second.compOnly)
{
setPlayerConnectedId(elem.second, id);
break;
}
}
}
}