Skip to content

Commit e0a9636

Browse files
authored
Controlbar Extensions
Allow more buttons in controlbar allow ViewportHeightScale to be parsed from ini
1 parent 10121d3 commit e0a9636

File tree

4 files changed

+26
-14
lines changed

4 files changed

+26
-14
lines changed

GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,9 @@ class CommandButton : public Overridable
406406
enum { MAX_COMMANDS_PER_SET = 32 }; // user interface max is 14 (but internally it's 18 for script only buttons!)
407407
enum { MAX_RIGHT_HUD_UPGRADE_CAMEOS = 5};
408408
enum {
409-
MAX_PURCHASE_SCIENCE_RANK_1 = 4,
410-
MAX_PURCHASE_SCIENCE_RANK_3 = 15,
411-
MAX_PURCHASE_SCIENCE_RANK_8 = 4,
409+
MAX_PURCHASE_SCIENCE_RANK_1 = 7,
410+
MAX_PURCHASE_SCIENCE_RANK_3 = 21,
411+
MAX_PURCHASE_SCIENCE_RANK_8 = 7,
412412
};
413413
enum { MAX_STRUCTURE_INVENTORY_BUTTONS = 10 }; // there are this many physical buttons in "inventory" windows for structures
414414
enum { MAX_BUILD_QUEUE_BUTTONS = 9 };// physical button count for the build queue

GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ GlobalData* GlobalData::m_theOriginal = NULL;
106106
{ "Use3WayTerrainBlends", INI::parseInt, NULL, offsetof( GlobalData, m_use3WayTerrainBlends ) },
107107
{ "StretchTerrain", INI::parseBool, NULL, offsetof( GlobalData, m_stretchTerrain ) },
108108
{ "UseHalfHeightMap", INI::parseBool, NULL, offsetof( GlobalData, m_useHalfHeightMap ) },
109-
109+
{ "ViewportHeightScale", INI::parseReal, NULL, offsetof( GlobalData, m_viewportHeightScale ) },
110110

111111
{ "DrawEntireTerrain", INI::parseBool, NULL, offsetof( GlobalData, m_drawEntireTerrain ) },
112112
{ "TerrainLOD", INI::parseIndexList, TerrainLODNames, offsetof( GlobalData, m_terrainLOD ) },

GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,14 @@ void ControlBar::populatePurchaseScience( Player* player )
179179
commandSet8 = TheControlBar->findCommandSet(player->getPlayerTemplate()->getPurchaseScienceCommandSetRank8()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING
180180

181181
for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_1; i++ )
182-
m_sciencePurchaseWindowsRank1[i]->winHide(TRUE);
182+
if (m_sciencePurchaseWindowsRank1[i]!=nullptr)
183+
m_sciencePurchaseWindowsRank1[i]->winHide(TRUE);
183184
for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_3; i++ )
184-
m_sciencePurchaseWindowsRank3[i]->winHide(TRUE);
185+
if (m_sciencePurchaseWindowsRank3[i] != nullptr)
186+
m_sciencePurchaseWindowsRank3[i]->winHide(TRUE);
185187
for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_8; i++ )
186-
m_sciencePurchaseWindowsRank8[i]->winHide(TRUE);
188+
if (m_sciencePurchaseWindowsRank8[i] != nullptr)
189+
m_sciencePurchaseWindowsRank8[i]->winHide(TRUE);
187190

188191

189192
// if no command set match is found hide all the buttons
@@ -204,7 +207,8 @@ void ControlBar::populatePurchaseScience( Player* player )
204207
if( commandButton == NULL || BitIsSet( commandButton->getOptions(), SCRIPT_ONLY ) )
205208
{
206209
// hide window on interface
207-
m_sciencePurchaseWindowsRank1[ i ]->winHide( TRUE );
210+
if(m_sciencePurchaseWindowsRank1[ i ] != nullptr)
211+
m_sciencePurchaseWindowsRank1[ i ]->winHide( TRUE );
208212
} // end if
209213
else
210214
{
@@ -264,7 +268,8 @@ void ControlBar::populatePurchaseScience( Player* player )
264268
if( commandButton == NULL || BitIsSet( commandButton->getOptions(), SCRIPT_ONLY ) )
265269
{
266270
// hide window on interface
267-
m_sciencePurchaseWindowsRank3[ i ]->winHide( TRUE );
271+
if (m_sciencePurchaseWindowsRank3[ i ] != nullptr)
272+
m_sciencePurchaseWindowsRank3[ i ]->winHide( TRUE );
268273
} // end if
269274
else
270275
{
@@ -327,7 +332,8 @@ void ControlBar::populatePurchaseScience( Player* player )
327332
if( commandButton == NULL || BitIsSet( commandButton->getOptions(), SCRIPT_ONLY ) )
328333
{
329334
// hide window on interface
330-
m_sciencePurchaseWindowsRank8[ i ]->winHide( TRUE );
335+
if (m_sciencePurchaseWindowsRank8[ i ] != nullptr)
336+
m_sciencePurchaseWindowsRank8[ i ]->winHide( TRUE );
331337
} // end if
332338
else
333339
{
@@ -1157,15 +1163,19 @@ void ControlBar::init( void )
11571163
id = TheNameKeyGenerator->nameToKey( windowName.str() );
11581164
m_sciencePurchaseWindowsRank1[ i ] =
11591165
TheWindowManager->winGetWindowFromId( m_contextParent[ CP_PURCHASE_SCIENCE ], id );
1160-
m_sciencePurchaseWindowsRank1[ i ]->winSetStatus( WIN_STATUS_USE_OVERLAY_STATES );
1166+
if (m_sciencePurchaseWindowsRank1[i] != nullptr) {
1167+
m_sciencePurchaseWindowsRank1[i]->winSetStatus(WIN_STATUS_USE_OVERLAY_STATES);
1168+
}
11611169
} // end for i
11621170
for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_3; i++ )
11631171
{
11641172
windowName.format( "GeneralsExpPoints.wnd:ButtonRank3Number%d", i );
11651173
id = TheNameKeyGenerator->nameToKey( windowName.str() );
11661174
m_sciencePurchaseWindowsRank3[ i ] =
11671175
TheWindowManager->winGetWindowFromId( m_contextParent[ CP_PURCHASE_SCIENCE ], id );
1168-
m_sciencePurchaseWindowsRank3[ i ]->winSetStatus( WIN_STATUS_USE_OVERLAY_STATES );
1176+
if (m_sciencePurchaseWindowsRank3[i] != nullptr) {
1177+
m_sciencePurchaseWindowsRank3[i]->winSetStatus(WIN_STATUS_USE_OVERLAY_STATES);
1178+
}
11691179
} // end for i
11701180

11711181
for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_8; i++ )
@@ -1174,7 +1184,9 @@ void ControlBar::init( void )
11741184
id = TheNameKeyGenerator->nameToKey( windowName.str() );
11751185
m_sciencePurchaseWindowsRank8[ i ] =
11761186
TheWindowManager->winGetWindowFromId( m_contextParent[ CP_PURCHASE_SCIENCE ], id );
1177-
m_sciencePurchaseWindowsRank8[ i ]->winSetStatus( WIN_STATUS_USE_OVERLAY_STATES );
1187+
if (m_sciencePurchaseWindowsRank8[i] != nullptr) {
1188+
m_sciencePurchaseWindowsRank8[i]->winSetStatus(WIN_STATUS_USE_OVERLAY_STATES);
1189+
}
11781190
} // end for i
11791191

11801192
// keep a pointer to the window making up the right HUD display

GeneralsMD/Code/Main/WinMain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
804804
{
805805
Int exitcode = 1;
806806
//#ifdef _DEBUG
807-
// WaitForDebugger(); //in debug build, wait for debugger attachment
807+
// WaitForDebugger(); //in debug build, wait for debugger attachment
808808
//#endif
809809

810810
#ifdef RTS_PROFILE

0 commit comments

Comments
 (0)