Player names of Scenarios were displayed in wrong slot.

The player names were set with wrong index and CPU players had wrong names.
This commit is contained in:
titiger 2014-11-14 22:25:56 +01:00
parent b85f9794e0
commit 71bdb1cba7
1 changed files with 15 additions and 7 deletions

View File

@ -480,6 +480,8 @@ void Scenario::loadGameSettings(const vector<string> &dirList,
const ScenarioInfo *scenarioInfo, GameSettings *gameSettings,
string scenarioDescription) {
int factionCount= 0;
int AIPlayerCount=0;
Lang &lang= Lang::getInstance();
if(gameSettings->getGameUUID() == "") {
gameSettings->setGameUUID(getUUIDAsString());
@ -501,15 +503,21 @@ void Scenario::loadGameSettings(const vector<string> &dirList,
if(ct == ctHuman) {
gameSettings->setThisFactionIndex(factionCount);
if(gameSettings->getNetworkPlayerName(i) == "") {
gameSettings->setNetworkPlayerName(i,Config::getInstance().getString("NetPlayerName",Socket::getHostName().c_str()));
if(gameSettings->getNetworkPlayerName(factionCount) == "") {
gameSettings->setNetworkPlayerName(factionCount,Config::getInstance().getString("NetPlayerName",Socket::getHostName().c_str()));
}
gameSettings->setNetworkPlayerUUID(i,Config::getInstance().getString("PlayerId",""));
gameSettings->setNetworkPlayerPlatform(i,getPlatformNameString());
gameSettings->setNetworkPlayerUUID(factionCount,Config::getInstance().getString("PlayerId",""));
gameSettings->setNetworkPlayerPlatform(factionCount,getPlatformNameString());
}
else {
if(gameSettings->getNetworkPlayerName(i) == "") {
gameSettings->setNetworkPlayerName(i,controllerTypeToStr(ct));
else if(ct == ctNetwork || ct == ctNetworkUnassigned){
if(gameSettings->getNetworkPlayerName(factionCount) == "") {
gameSettings->setNetworkPlayerName(factionCount,controllerTypeToStr(ct));
}
}
else {//this is a CPU player
AIPlayerCount++;
if(gameSettings->getNetworkPlayerName(factionCount) == "") {
gameSettings->setNetworkPlayerName(factionCount,lang.getString("AI") + intToStr(AIPlayerCount));
}
}
gameSettings->setFactionControl(factionCount, ct);