- additional bugfix when restoring last game settings
This commit is contained in:
parent
d1d6fb2eb1
commit
dfb6c130ca
|
@ -264,7 +264,7 @@ string BattleEnd::getBattleEndMusic(bool won) {
|
|||
void BattleEnd::initBackgroundMusic() {
|
||||
string music = "";
|
||||
|
||||
if(stats.getThisFactionIndex() > 0 && stats.getTeam(stats.getThisFactionIndex()) != GameConstants::maxPlayers -1 + fpt_Observer) {
|
||||
if(stats.getThisFactionIndex() >= 0 && stats.getTeam(stats.getThisFactionIndex()) != GameConstants::maxPlayers -1 + fpt_Observer) {
|
||||
if(stats.getVictory(stats.getThisFactionIndex())){
|
||||
//header += lang.getString("Victory");
|
||||
music = getBattleEndMusic(true);
|
||||
|
@ -299,7 +299,7 @@ void BattleEnd::initBackgroundVideo() {
|
|||
string videoFile = "";
|
||||
string videoFileFallback = "";
|
||||
|
||||
if(stats.getThisFactionIndex() > 0 && stats.getTeam(stats.getThisFactionIndex()) != GameConstants::maxPlayers -1 + fpt_Observer) {
|
||||
if(stats.getThisFactionIndex() >= 0 && stats.getTeam(stats.getThisFactionIndex()) != GameConstants::maxPlayers -1 + fpt_Observer) {
|
||||
if(stats.getVictory(stats.getThisFactionIndex())){
|
||||
//header += lang.getString("Victory");
|
||||
|
||||
|
@ -682,7 +682,7 @@ void BattleEnd::render() {
|
|||
|
||||
string header = stats.getDescription() + " - ";
|
||||
|
||||
if(stats.getThisFactionIndex() > 0 && stats.getTeam(stats.getThisFactionIndex()) != GameConstants::maxPlayers -1 + fpt_Observer) {
|
||||
if(stats.getThisFactionIndex() >= 0 && stats.getTeam(stats.getThisFactionIndex()) != GameConstants::maxPlayers -1 + fpt_Observer) {
|
||||
if(stats.getVictory(stats.getThisFactionIndex())){
|
||||
header += lang.getString("Victory");
|
||||
}
|
||||
|
|
|
@ -3825,28 +3825,30 @@ void MenuStateCustomGame::saveGameSettingsToFile(std::string fileName) {
|
|||
|
||||
void MenuStateCustomGame::KeepCurrentHumanPlayerSlots(GameSettings &gameSettings) {
|
||||
//look for human players
|
||||
bool foundValidHumanControlTypeInFile = false;
|
||||
for(int index2 = 0; index2 < GameConstants::maxPlayers; ++index2) {
|
||||
ControlType ctFile = static_cast<ControlType>(gameSettings.getFactionControl(index2));
|
||||
if(ctFile == ctHuman) {
|
||||
ControlType ctUI = static_cast<ControlType>(listBoxControls[index2].getSelectedItemIndex());
|
||||
if(ctUI != ctNetwork && ctUI != ctNetworkUnassigned) {
|
||||
foundValidHumanControlTypeInFile = true;
|
||||
//printf("Human found in file [%d]\n",index2);
|
||||
}
|
||||
else if(labelPlayerNames[index2].getText() == "") {
|
||||
foundValidHumanControlTypeInFile = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int index = 0; index < GameConstants::maxPlayers; ++index) {
|
||||
ControlType ct= static_cast<ControlType>(listBoxControls[index].getSelectedItemIndex());
|
||||
if(ct == ctHuman) {
|
||||
|
||||
bool foundControlType = false;
|
||||
for(int index2 = 0; index2 < GameConstants::maxPlayers; ++index2) {
|
||||
ControlType ctFile = static_cast<ControlType>(gameSettings.getFactionControl(index2));
|
||||
if(ctFile == ctHuman) {
|
||||
ControlType ctUI = static_cast<ControlType>(listBoxControls[index2].getSelectedItemIndex());
|
||||
if(ctUI != ctNetwork && ctUI != ctNetworkUnassigned) {
|
||||
foundControlType = true;
|
||||
//printf("Human found in file [%d]\n",index2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//printf("Human found in UI [%d] and file [%d]\n",index,foundControlType);
|
||||
|
||||
if(foundControlType == false) {
|
||||
if(foundValidHumanControlTypeInFile == false) {
|
||||
gameSettings.setFactionControl(index,ctHuman);
|
||||
gameSettings.setNetworkPlayerName(index,getHumanPlayerName());
|
||||
}
|
||||
gameSettings.setNetworkPlayerName(index,getHumanPlayerName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue