diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp index 4072ce98ad5..b97598e9cb0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp @@ -858,6 +858,8 @@ void LanGameOptionsMenuInit( WindowLayout *layout, void *userData ) slot->setNATBehavior(FirewallHelperClass::FIREWALL_TYPE_SIMPLE); game->setMap( pref.getPreferredMap() ); game->setStartingCash( pref.getStartingCash() ); + // TheSuperHackers @bugfix Re-populate starting cash combo box after applying user preferences. + PopulateStartingCashComboBox(comboBoxStartingCash, game); game->setSuperweaponRestriction( pref.getSuperweaponRestricted() ? 1 : 0 ); AsciiString lowerMap = pref.getPreferredMap(); lowerMap.toLower(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp index 580098b6af9..f9008d90ec5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp @@ -1317,6 +1317,8 @@ void SkirmishGameOptionsMenuInit( WindowLayout *layout, void *userData ) } TheSkirmishGameInfo->setStartingCash( prefs.getStartingCash() ); + // TheSuperHackers @bugfix Re-populate starting cash combo box after applying user preferences. + PopulateStartingCashComboBox(comboBoxStartingCash, TheSkirmishGameInfo); TheSkirmishGameInfo->setSuperweaponRestriction( prefs.getSuperweaponRestricted() ? 1 : 0 ); TheSkirmishGameInfo->setMap(prefs.getPreferredMap()); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp index f360ba9423b..5bfec543970 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp @@ -1377,6 +1377,8 @@ void WOLGameSetupMenuInit( WindowLayout *layout, void *userData ) // This should probably be enforced at the gamespy level as well, to prevent exploits. Int isUsingStats = TheGameSpyGame->getUseStats(); game->setStartingCash( isUsingStats? TheMultiplayerSettings->getDefaultStartingMoney() : customPref.getStartingCash() ); + // TheSuperHackers @bugfix Re-populate starting cash combo box after applying user preferences. + PopulateStartingCashComboBox(comboBoxStartingCash, game); game->setSuperweaponRestriction( isUsingStats? 0 : customPref.getSuperweaponRestricted() ? 1 : 0 ); if (isUsingStats) game->setOldFactionsOnly( 0 ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp index 0df5ca5a057..e9a58d4ba76 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp @@ -352,7 +352,8 @@ void PopulateStartingCashComboBox(GameWindow *comboBox, GameInfo *myGame) DEBUG_CRASH( ("Current selection for starting cash not found in list") ); currentSelectionIndex = GadgetComboBoxAddEntry(comboBox, formatMoneyForStartingCashComboBox( myGame->getStartingCash() ), comboBox->winGetEnabled() ? comboBox->winGetEnabledTextColor() : comboBox->winGetDisabledTextColor()); - GadgetComboBoxSetItemData(comboBox, currentSelectionIndex, (void *)it->countMoney() ); + // TheSuperHackers @bugfix Fix undefined behavior from dereferencing past-the-end iterator. + GadgetComboBoxSetItemData(comboBox, currentSelectionIndex, (void *)myGame->getStartingCash().countMoney() ); } GadgetComboBoxSetSelectedPos(comboBox, currentSelectionIndex);