Fix community not set for servers with missing server info

The server community was only initialized when receiving server info. This caused servers for which no server info is received to be hidden when using the community filter. Now the community filter also works correctly for servers for which no ordinary server info is received, by initializing the community already when adding server entries to the list.

Closes #7776.
This commit is contained in:
Robert Müller 2024-01-08 21:42:52 +01:00
parent fda996014b
commit 6bdc73ad3d

View file

@ -550,7 +550,9 @@ void CServerBrowser::SetInfo(CServerEntry *pEntry, const CServerInfo &Info) cons
mem_copy(pEntry->m_Info.m_aAddresses, TmpInfo.m_aAddresses, sizeof(pEntry->m_Info.m_aAddresses));
pEntry->m_Info.m_NumAddresses = TmpInfo.m_NumAddresses;
ServerBrowserFormatAddresses(pEntry->m_Info.m_aAddress, sizeof(pEntry->m_Info.m_aAddress), pEntry->m_Info.m_aAddresses, pEntry->m_Info.m_NumAddresses);
UpdateServerCommunity(&pEntry->m_Info);
str_copy(pEntry->m_Info.m_aCommunityId, TmpInfo.m_aCommunityId);
str_copy(pEntry->m_Info.m_aCommunityCountry, TmpInfo.m_aCommunityCountry);
str_copy(pEntry->m_Info.m_aCommunityType, TmpInfo.m_aCommunityType);
UpdateServerRank(&pEntry->m_Info);
if(pEntry->m_Info.m_ClientScoreKind == CServerInfo::CLIENT_SCORE_KIND_UNSPECIFIED)
@ -662,6 +664,7 @@ CServerBrowser::CServerEntry *CServerBrowser::Add(const NETADDR *pAddrs, int Num
pEntry->m_Info.m_Latency = 999;
pEntry->m_Info.m_HasRank = CServerInfo::RANK_UNAVAILABLE;
ServerBrowserFormatAddresses(pEntry->m_Info.m_aAddress, sizeof(pEntry->m_Info.m_aAddress), pEntry->m_Info.m_aAddresses, pEntry->m_Info.m_NumAddresses);
UpdateServerCommunity(&pEntry->m_Info);
str_copy(pEntry->m_Info.m_aName, pEntry->m_Info.m_aAddress, sizeof(pEntry->m_Info.m_aName));
// check if it's a favorite