Refresh server list when the browser is activated

This commit is contained in:
Kawe Mazidjatari 2022-09-14 02:39:55 +02:00
parent 242320e735
commit 84b4772006
2 changed files with 16 additions and 3 deletions

View File

@ -43,9 +43,6 @@ CBrowser::CBrowser(void)
{
memset(m_szServerAddressBuffer, '\0', sizeof(m_szServerAddressBuffer));
std::thread refresh(&CBrowser::RefreshServerList, this);
refresh.detach();
m_pszBrowserTitle = "Server Browser";
m_rLockedIconBlob = GetModuleResource(IDB_PNG2);
}
@ -136,6 +133,21 @@ void CBrowser::RunTask()
UpdateHostingStatus();
timer.Start();
}
if (m_bActivate)
{
if (m_bQueryListNonRecursive)
{
std::thread refresh(&CBrowser::RefreshServerList, g_pBrowser);
refresh.detach();
m_bQueryListNonRecursive = false;
}
}
else // Refresh server list the next time 'm_bActivate' evaluates to true.
{
m_bQueryListNonRecursive = true;
}
}
//-----------------------------------------------------------------------------

View File

@ -42,6 +42,7 @@ public:
private:
bool m_bInitialized = false;
bool m_bQueryListNonRecursive = false; // When set, refreshes the server list once the next frame.
char m_szServerAddressBuffer[256] = { '\0' };
char m_szServerEncKeyBuffer[30] = { '\0' };
float m_flFadeAlpha = 0.f;