menu_state_custom_game.cpp:when slots open, switch to British

With enhanced observer mode, When a map is changed from 8 players to 4,
this switches factions 5-8 from Observer to British (used faction "0"
for the default, which translates to British in this situation) and
allows teams to be changed.
This commit is contained in:
andy5995
2018-03-04 12:02:45 -06:00
committed by Andy Alt
parent e135baba85
commit 6dbb62cafa

View File

@@ -4370,10 +4370,6 @@ namespace Glest
for (int i = 0; i < GameConstants::maxPlayers; ++i) for (int i = 0; i < GameConstants::maxPlayers; ++i)
{ {
// FIXME: The contents of this if block could be refactored;
// Some of same statements are used in each condtion.
// please test afteward.
//
if (i >= mapInfo.hardMaxPlayers) if (i >= mapInfo.hardMaxPlayers)
{ {
if (checkBoxAllowObservers.getValue() == false) if (checkBoxAllowObservers.getValue() == false)
@@ -4381,8 +4377,6 @@ namespace Glest
listBoxControls[i].setSelectedItemIndex (ctClosed); listBoxControls[i].setSelectedItemIndex (ctClosed);
listBoxControls[i].setEditable (false); listBoxControls[i].setEditable (false);
listBoxControls[i].setEnabled (false); listBoxControls[i].setEnabled (false);
listBoxRMultiplier[i].setEditable (false);
listBoxRMultiplier[i].setEnabled (false);
} }
else else
{ {
@@ -4393,11 +4387,12 @@ namespace Glest
listBoxTeams[i].setSelectedItem (intToStr (GameConstants::maxPlayers + listBoxTeams[i].setSelectedItem (intToStr (GameConstants::maxPlayers +
fpt_Observer)); fpt_Observer));
listBoxTeams[i].setEditable (false); listBoxTeams[i].setEditable (false);
}
listBoxRMultiplier[i].setEditable (false); listBoxRMultiplier[i].setEditable (false);
listBoxRMultiplier[i].setEnabled (false); listBoxRMultiplier[i].setEnabled (false);
listBoxRMultiplier[i].setVisible (false); listBoxRMultiplier[i].setVisible (false);
} }
}
else if (listBoxControls[i].getSelectedItemIndex () != else if (listBoxControls[i].getSelectedItemIndex () !=
ctNetworkUnassigned) ctNetworkUnassigned)
{ {
@@ -4412,6 +4407,7 @@ namespace Glest
listBoxControls[i].setEnabled (true); listBoxControls[i].setEnabled (true);
listBoxFactions[i].setEditable (true); listBoxFactions[i].setEditable (true);
listBoxTeams[i].setEditable (true); listBoxTeams[i].setEditable (true);
listBoxFactions[i].setSelectedItemIndex (0);
} }
else else
{ {
@@ -4441,7 +4437,7 @@ namespace Glest
} while (++i < GameConstants::maxPlayers); } while (++i < GameConstants::maxPlayers);
} }
updateNetworkSlots (); // updateNetworkSlots ();
bool checkDataSynch = bool checkDataSynch =
(serverInterface->getAllowGameDataSynchCheck () == true (serverInterface->getAllowGameDataSynchCheck () == true