Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 7250db8

Browse files
committed
Make the root screen not a null object
1 parent 2a06dc9 commit 7250db8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Menus/MainMenuGUI.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ int MainMenuGUI::Create(Controller *pController)
182182
m_pGUIController->Load("Base.rte/GUIs/MainMenuGUI.ini");
183183

184184
// Make sure we have convenient points to the containing GUI colleciton boxes that we will manipulate the positions of
185-
GUICollectionBox *pRootBox = dynamic_cast<GUICollectionBox *>(m_pGUIController->GetControl("root"));
185+
m_apScreenBox[ROOT] = dynamic_cast<GUICollectionBox *>(m_pGUIController->GetControl("root"));
186186
m_apScreenBox[MAINSCREEN] = dynamic_cast<GUICollectionBox *>(m_pGUIController->GetControl("MainScreen"));
187187
m_apScreenBox[PLAYERSSCREEN] = dynamic_cast<GUICollectionBox *>(m_pGUIController->GetControl("PlayersScreen"));
188188
m_apScreenBox[SKIRMISHSCREEN] = dynamic_cast<GUICollectionBox *>(m_pGUIController->GetControl("SkirmishScreen"));
@@ -195,6 +195,7 @@ int MainMenuGUI::Create(Controller *pController)
195195
m_apScreenBox[QUITSCREEN] = dynamic_cast<GUICollectionBox *>(m_pGUIController->GetControl("QuitConfirmBox"));
196196
m_apScreenBox[MODMANAGERSCREEN] = dynamic_cast<GUICollectionBox *>(m_pGUIController->GetControl("ModManagerScreen"));
197197

198+
GUICollectionBox *pRootBox = m_apScreenBox[ROOT];
198199
pRootBox->SetPositionAbs((g_FrameMan.GetResX() - pRootBox->GetWidth()) / 2, 0);// (g_FrameMan.GetResY() - pRootBox->GetHeight()) / 2);
199200
// NO, this screws up the menu positioning!
200201
// pRootBox->Resize(pRootBox->GetWidth(), g_FrameMan.GetResY());
@@ -1848,7 +1849,7 @@ void MainMenuGUI::Draw(BITMAP *drawBitmap) const
18481849

18491850
void MainMenuGUI::HideAllScreens()
18501851
{
1851-
for (int iscreen = 0; iscreen < SCREENCOUNT; ++iscreen)
1852+
for (int iscreen = MAINSCREEN; iscreen < SCREENCOUNT; ++iscreen)
18521853
{
18531854
if (m_apScreenBox[iscreen])
18541855
m_apScreenBox[iscreen]->SetVisible(false);

0 commit comments

Comments
 (0)