Skip to content

Commit 2b6d5bd

Browse files
committed
Replicate in Generals
1 parent a7040be commit 2b6d5bd

File tree

1 file changed

+53
-39
lines changed
  • Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus

1 file changed

+53
-39
lines changed

Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp

Lines changed: 53 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -923,11 +923,14 @@ static void saveOptions( void )
923923

924924
//-------------------------------------------------------------------------------------------------
925925
// send Delay
926-
TheWritableGlobalData->m_firewallSendDelay = GadgetCheckBoxIsChecked(checkSendDelay);
927-
if (TheGlobalData->m_firewallSendDelay) {
928-
(*pref)["SendDelay"] = AsciiString("yes");
929-
} else {
930-
(*pref)["SendDelay"] = AsciiString("no");
926+
if (checkSendDelay && checkSendDelay->winGetEnabled())
927+
{
928+
TheWritableGlobalData->m_firewallSendDelay = GadgetCheckBoxIsChecked(checkSendDelay);
929+
if (TheGlobalData->m_firewallSendDelay) {
930+
(*pref)["SendDelay"] = AsciiString("yes");
931+
} else {
932+
(*pref)["SendDelay"] = AsciiString("no");
933+
}
931934
}
932935

933936
//-------------------------------------------------------------------------------------------------
@@ -1000,29 +1003,33 @@ static void saveOptions( void )
10001003

10011004
//-------------------------------------------------------------------------------------------------
10021005
// LOD
1003-
Bool levelChanged=FALSE;
1004-
GadgetComboBoxGetSelectedPos( comboBoxDetail, &index );
1005-
//The levels stored by the LOD Manager are inverted compared to GUI so find correct one:
1006-
switch (index) {
1007-
case HIGHDETAIL:
1008-
levelChanged=TheGameLODManager->setStaticLODLevel(STATIC_GAME_LOD_HIGH);
1009-
break;
1010-
case MEDIUMDETAIL:
1011-
levelChanged=TheGameLODManager->setStaticLODLevel(STATIC_GAME_LOD_MEDIUM);
1012-
break;
1013-
case LOWDETAIL:
1014-
levelChanged=TheGameLODManager->setStaticLODLevel(STATIC_GAME_LOD_LOW);
1015-
break;
1016-
case CUSTOMDETAIL:
1017-
levelChanged=TheGameLODManager->setStaticLODLevel(STATIC_GAME_LOD_CUSTOM);
1018-
break;
1019-
default:
1020-
DEBUG_ASSERTCRASH(FALSE,("LOD passed in was %d, %d is not a supported LOD",index,index));
1021-
break;
1022-
}
1006+
if (comboBoxDetail && comboBoxDetail->winGetEnabled())
1007+
{
1008+
Bool levelChanged=FALSE;
1009+
GadgetComboBoxGetSelectedPos( comboBoxDetail, &index );
10231010

1024-
if (levelChanged)
1025-
(*pref)["StaticGameLOD"] = TheGameLODManager->getStaticGameLODLevelName(TheGameLODManager->getStaticLODLevel());
1011+
//The levels stored by the LOD Manager are inverted compared to GUI so find correct one:
1012+
switch (index) {
1013+
case HIGHDETAIL:
1014+
levelChanged=TheGameLODManager->setStaticLODLevel(STATIC_GAME_LOD_HIGH);
1015+
break;
1016+
case MEDIUMDETAIL:
1017+
levelChanged=TheGameLODManager->setStaticLODLevel(STATIC_GAME_LOD_MEDIUM);
1018+
break;
1019+
case LOWDETAIL:
1020+
levelChanged=TheGameLODManager->setStaticLODLevel(STATIC_GAME_LOD_LOW);
1021+
break;
1022+
case CUSTOMDETAIL:
1023+
levelChanged=TheGameLODManager->setStaticLODLevel(STATIC_GAME_LOD_CUSTOM);
1024+
break;
1025+
default:
1026+
DEBUG_ASSERTCRASH(FALSE,("LOD passed in was %d, %d is not a supported LOD",index,index));
1027+
break;
1028+
}
1029+
1030+
if (levelChanged)
1031+
(*pref)["StaticGameLOD"] = TheGameLODManager->getStaticGameLODLevelName(TheGameLODManager->getStaticLODLevel());
1032+
}
10261033

10271034
//-------------------------------------------------------------------------------------------------
10281035
// Resolution
@@ -1034,12 +1041,11 @@ static void saveOptions( void )
10341041
oldDispSettings.bitDepth = TheDisplay->getBitDepth();
10351042
oldDispSettings.windowed = TheDisplay->getWindowed();
10361043

1037-
if (index < TheDisplay->getDisplayModeCount() && index >= 0)
1044+
if (comboBoxResolution && comboBoxResolution->winGetEnabled() && index < TheDisplay->getDisplayModeCount() && index >= 0)
10381045
{
10391046
TheDisplay->getDisplayModeDescription(index,&xres,&yres,&bitDepth);
10401047
if (TheGlobalData->m_xResolution != xres || TheGlobalData->m_yResolution != yres)
10411048
{
1042-
10431049
if (TheDisplay->setDisplayMode(xres,yres,bitDepth,TheDisplay->getWindowed()))
10441050
{
10451051
dispChanged = TRUE;
@@ -1077,19 +1083,27 @@ static void saveOptions( void )
10771083

10781084
//-------------------------------------------------------------------------------------------------
10791085
// IP address
1080-
UnsignedInt ip;
1081-
GadgetComboBoxGetSelectedPos(comboBoxLANIP, &index);
1082-
if (index>=0 && TheGlobalData)
1086+
if (comboBoxLANIP && comboBoxLANIP->winGetEnabled())
10831087
{
1084-
ip = (UnsignedInt)GadgetComboBoxGetItemData(comboBoxLANIP, index);
1085-
TheWritableGlobalData->m_defaultIP = ip;
1086-
pref->setLANIPAddress(ip);
1088+
UnsignedInt ip;
1089+
GadgetComboBoxGetSelectedPos(comboBoxLANIP, &index);
1090+
if (index>=0 && TheGlobalData)
1091+
{
1092+
ip = (UnsignedInt)GadgetComboBoxGetItemData(comboBoxLANIP, index);
1093+
TheWritableGlobalData->m_defaultIP = ip;
1094+
pref->setLANIPAddress(ip);
1095+
}
10871096
}
1088-
GadgetComboBoxGetSelectedPos(comboBoxOnlineIP, &index);
1089-
if (index>=0)
1097+
1098+
if (comboBoxOnlineIP && comboBoxOnlineIP->winGetEnabled())
10901099
{
1091-
ip = (UnsignedInt)GadgetComboBoxGetItemData(comboBoxOnlineIP, index);
1092-
pref->setOnlineIPAddress(ip);
1100+
UnsignedInt ip;
1101+
GadgetComboBoxGetSelectedPos(comboBoxOnlineIP, &index);
1102+
if (index>=0)
1103+
{
1104+
ip = (UnsignedInt)GadgetComboBoxGetItemData(comboBoxOnlineIP, index);
1105+
pref->setOnlineIPAddress(ip);
1106+
}
10931107
}
10941108

10951109
//-------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)