From 73127217430ebadaabb41a9d71f1a111f41d6e34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Thu, 26 Oct 2023 21:24:53 +0200 Subject: [PATCH 1/2] Remove redundant server browser refresh on client start The `RefreshBrowserTab` function already does the respective `ServerBrowser()->Refresh(...)` calls. --- src/game/client/components/menus.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 5c34d8409..158244f38 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -978,19 +978,8 @@ int CMenus::Render() else if(s_Frame == 1) { UpdateMusicState(); - s_Frame++; - RefreshBrowserTab(g_Config.m_UiPage); - if(g_Config.m_UiPage == PAGE_INTERNET) - ServerBrowser()->Refresh(IServerBrowser::TYPE_INTERNET); - else if(g_Config.m_UiPage == PAGE_LAN) - ServerBrowser()->Refresh(IServerBrowser::TYPE_LAN); - else if(g_Config.m_UiPage == PAGE_FAVORITES) - ServerBrowser()->Refresh(IServerBrowser::TYPE_FAVORITES); - else if(g_Config.m_UiPage == PAGE_DDNET) - ServerBrowser()->Refresh(IServerBrowser::TYPE_DDNET); - else if(g_Config.m_UiPage == PAGE_KOG) - ServerBrowser()->Refresh(IServerBrowser::TYPE_KOG); + s_Frame++; } if(Client()->State() >= IClient::STATE_ONLINE) From 68e481945b7abc9db0448c068cecfe2c09bee85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Thu, 26 Oct 2023 21:19:09 +0200 Subject: [PATCH 2/2] Fix incorrect menu behavior when quitting/restarting Only consider `STATE_ONLINE` and `STATE_DEMOPLAYBACK` as ingame. Closes #7178. --- src/game/client/components/menu_background.cpp | 2 +- src/game/client/components/menus.cpp | 2 +- src/game/client/components/menus_settings.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/client/components/menu_background.cpp b/src/game/client/components/menu_background.cpp index 0b1dc8d29..2062899c2 100644 --- a/src/game/client/components/menu_background.cpp +++ b/src/game/client/components/menu_background.cpp @@ -323,7 +323,7 @@ bool CMenuBackground::Render() if(!m_Loaded) return false; - if(Client()->State() >= IClient::STATE_ONLINE) + if(Client()->State() == IClient::STATE_ONLINE || Client()->State() == IClient::STATE_DEMOPLAYBACK) return false; m_Camera.m_Zoom = 0.7f; diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 158244f38..e668cd6fa 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -982,7 +982,7 @@ int CMenus::Render() s_Frame++; } - if(Client()->State() >= IClient::STATE_ONLINE) + if(Client()->State() == IClient::STATE_ONLINE || Client()->State() == IClient::STATE_DEMOPLAYBACK) { ms_ColorTabbarInactive = ms_ColorTabbarInactiveIngame; ms_ColorTabbarActive = ms_ColorTabbarActiveIngame; diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index ac70e16a9..1e1c881c8 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -389,7 +389,7 @@ void CMenus::RefreshSkins() RenderLoading(Localize("Loading skin files"), "", 0, false); } }); - if(Client()->State() >= IClient::STATE_ONLINE) + if(Client()->State() == IClient::STATE_ONLINE || Client()->State() == IClient::STATE_DEMOPLAYBACK) { m_pClient->RefindSkins(); }