@@ -144,6 +144,8 @@ void setEnabledButtons()
144144{
145145 for (Int i = 0 ; i < NUM_GENERALS; i++)
146146 {
147+ if (!buttonGeneralPosition[i]) // TheSuperHackers @tweak DayV 21/09/2025 Increase number of challenge generals.
148+ continue ;
147149 const GeneralPersona* generals = TheChallengeGenerals->getChallengeGenerals ();
148150 buttonGeneralPosition[i]->winEnable (generals[i].isStartingEnabled ());
149151 buttonGeneralPosition[i]->winHide (! generals[i].isStartingEnabled ());
@@ -238,7 +240,8 @@ void updateButtonSequence(Int stepsPerUpdate)
238240 {
239241 // selected look
240242 Int pos = buttonSequenceStep;
241- if (pos < NUM_GENERALS && !buttonGeneralPosition[pos]->winIsHidden ())
243+ // TheSuperHackers @tweak DayV 21/09/2025 Increase number of challenge generals.
244+ if (pos < NUM_GENERALS && buttonGeneralPosition[pos] && !buttonGeneralPosition[pos]->winIsHidden ())
242245 {
243246 Int templateNum = ThePlayerTemplateStore->getTemplateNumByName (generals[pos].getPlayerTemplateName ());
244247 const PlayerTemplate *playerTemplate = ThePlayerTemplateStore->getNthPlayerTemplate (templateNum);
@@ -247,7 +250,7 @@ void updateButtonSequence(Int stepsPerUpdate)
247250 }
248251
249252 // mouseover look
250- if (--pos > 0 && pos < NUM_GENERALS && !buttonGeneralPosition[pos]->winIsHidden ())
253+ if (--pos > 0 && pos < NUM_GENERALS && buttonGeneralPosition[pos] && !buttonGeneralPosition[pos]->winIsHidden ())
251254 {
252255 Int templateNum = ThePlayerTemplateStore->getTemplateNumByName (generals[pos].getPlayerTemplateName ());
253256 const PlayerTemplate *playerTemplate = ThePlayerTemplateStore->getNthPlayerTemplate (templateNum);
@@ -256,7 +259,7 @@ void updateButtonSequence(Int stepsPerUpdate)
256259 }
257260
258261 // regular look
259- if (--pos > 0 && pos < NUM_GENERALS && !buttonGeneralPosition[pos]->winIsHidden ())
262+ if (--pos > 0 && pos < NUM_GENERALS && buttonGeneralPosition[pos] && !buttonGeneralPosition[pos]->winIsHidden ())
260263 {
261264 Int templateNum = ThePlayerTemplateStore->getTemplateNumByName (generals[pos].getPlayerTemplateName ());
262265 const PlayerTemplate *playerTemplate = ThePlayerTemplateStore->getNthPlayerTemplate (templateNum);
@@ -365,10 +368,10 @@ void ChallengeMenuInit( WindowLayout *layout, void *userData )
365368 strButtonName.format (" ChallengeMenu.wnd:GeneralPosition%d" , i);
366369 buttonGeneralPositionID[i] = TheNameKeyGenerator->nameToKey ( strButtonName );
367370 buttonGeneralPosition[i] = TheWindowManager->winGetWindowFromId ( parentMenu, buttonGeneralPositionID[i] );
368- DEBUG_ASSERTCRASH (buttonGeneralPosition[i], ( " Could not find the ButtonGeneralPosition[%d] " ,i ));
369-
370- // start all buttons hidden, then expose them later if there is a general for this spot
371- buttonGeneralPosition[i]->winHide ( TRUE );
371+ // TheSuperHackers @tweak DayV 21/09/2025 Increase number of challenge generals.
372+ if (buttonGeneralPosition[i])
373+ // start all buttons hidden, then expose them later if there is a general for this spot
374+ buttonGeneralPosition[i]->winHide ( TRUE );
372375 }
373376
374377 // set defaults
0 commit comments