mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
code review
This commit is contained in:
parent
0c6b1ca3c8
commit
785c6507a6
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user