1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

code review

This commit is contained in:
Laserlicht 2023-10-13 23:50:01 +02:00 committed by GitHub
parent 0c6b1ca3c8
commit 785c6507a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -837,15 +837,21 @@ void CVCMIServer::setPlayer(PlayerColor clickedColor)
void CVCMIServer::setPlayerName(PlayerColor color, std::string name)
{
PlayerSettings & player = si->playerInfos[color];
if(color == PlayerColor::CANNOT_DETERMINE)
return;
if(player.isControlledByHuman())
{
int nameID = *(player.connectedPlayerIDs.begin()); //if not AI - set appropiate ID
PlayerSettings & player = si->playerInfos.at(color);
playerNames[nameID].name = name;
setPlayerConnectedId(player, nameID);
}
if(!player.isControlledByHuman())
return;
if(!player.connectedPlayerIDs.size())
return;
int nameID = *(player.connectedPlayerIDs.begin()); //if not AI - set appropiate ID
playerNames[nameID].name = name;
setPlayerConnectedId(player, nameID);
}
void CVCMIServer::optionNextCastle(PlayerColor player, int dir)