@@ -447,7 +447,7 @@ void CMainMenu::Update()
447447
448448 // Get the game interface and the system state
449449 CGame* pGame = CCore::GetSingleton ().GetGame ();
450- eSystemState SystemState = pGame->GetSystemState ();
450+ SystemState systemState = pGame->GetSystemState ();
451451
452452 m_Credits.Update ();
453453 m_Settings.Update ();
@@ -650,7 +650,7 @@ void CMainMenu::Update()
650650 }
651651
652652 // Force the mainmenu on if we're at GTA's mainmenu or not ingame
653- if ((SystemState == 7 || SystemState == 9 ) && !m_bIsIngame)
653+ if ((systemState == SystemState::GS_FRONTEND || systemState == SystemState::GS_PLAYING_GAME ) && !m_bIsIngame)
654654 {
655655 if (!m_bStarted)
656656 {
@@ -671,11 +671,11 @@ void CMainMenu::Update()
671671 }
672672
673673 // If we're visible
674- if (m_bIsVisible && SystemState != 8 )
674+ if (m_bIsVisible && systemState != SystemState::GS_INIT_PLAYING_GAME )
675675 {
676676 // If we're at the game's mainmenu, or ingame when m_bIsIngame is true show the background
677- if (SystemState == 7 || // GS_FRONTEND
678- SystemState == 9 && !m_bIsIngame) // GS_PLAYING_GAME
677+ if (systemState == SystemState::GS_FRONTEND ||
678+ systemState == SystemState::GS_PLAYING_GAME && !m_bIsIngame)
679679 {
680680 if (m_ucFade == FADE_INVISIBLE)
681681 Show (false );
@@ -842,6 +842,14 @@ bool CMainMenu::OnMenuClick(CGUIMouseEventArgs Args)
842842 case MENU_ITEM_MAP_EDITOR:
843843 AskUserIfHeWantsToDisconnect (m_pHoveredItem->menuType );
844844 return true ;
845+ case MENU_ITEM_DISCONNECT:
846+ if (g_pCore->GetCVars ()->GetValue (" ask_before_disconnect" , true ))
847+ {
848+ AskUserIfHeWantsToDisconnect (m_pHoveredItem->menuType );
849+ return true ;
850+ }
851+
852+ break ;
845853 default :
846854 break ;
847855 }
@@ -863,7 +871,7 @@ bool CMainMenu::OnMenuClick(CGUIMouseEventArgs Args)
863871 switch (m_pHoveredItem->menuType )
864872 {
865873 case MENU_ITEM_DISCONNECT:
866- OnDisconnectButtonClick (pElement );
874+ OnDisconnectButtonClick ();
867875 break ;
868876 case MENU_ITEM_QUICK_CONNECT:
869877 OnQuickConnectButtonClick (pElement, Args.button == LeftButton);
@@ -948,7 +956,7 @@ void CMainMenu::HideServerInfo()
948956 m_ServerInfo.Hide ();
949957}
950958
951- bool CMainMenu::OnDisconnectButtonClick (CGUIElement* pElement )
959+ bool CMainMenu::OnDisconnectButtonClick ()
952960{
953961 // Return if we haven't faded in yet
954962 if (m_ucFade != FADE_VISIBLE)
@@ -1251,6 +1259,9 @@ void CMainMenu::WantsToDisconnectCallBack(void* pData, uint uiButton)
12511259 case MENU_ITEM_MAP_EDITOR:
12521260 OnEditorButtonClick ();
12531261 break ;
1262+ case MENU_ITEM_DISCONNECT:
1263+ OnDisconnectButtonClick ();
1264+ break ;
12541265 default :
12551266 break ;
12561267 }
0 commit comments