Also recheck official server status when json gets loaded

This commit is contained in:
def 2019-03-19 07:57:09 +01:00
parent 4f515bf67e
commit ed5b08e7dc
2 changed files with 22 additions and 0 deletions

View file

@ -1088,6 +1088,22 @@ void CServerBrowser::LoadDDNetServers()
} }
} }
void CServerBrowser::RecheckOfficial()
{
for(int i = 0; i < m_NumDDNetCountries; i++)
{
CDDNetCountry *pCntr = &m_aDDNetCountries[i];
for(int j = 0; j < pCntr->m_NumServers; j++)
{
CServerEntry *pEntry = Find(pCntr->m_aServers[j]);
if(pEntry)
{
pEntry->m_Info.m_Official = true;
}
}
}
}
void CServerBrowser::LoadDDNetRanks() void CServerBrowser::LoadDDNetRanks()
{ {
for(int i = 0; i < m_NumServers; i++) for(int i = 0; i < m_NumServers; i++)
@ -1163,9 +1179,14 @@ const json_value *CServerBrowser::LoadDDNetInfo()
LoadDDNetServers(); LoadDDNetServers();
if(m_NumServers == 0) if(m_NumServers == 0)
{
Refresh(m_ServerlistType); Refresh(m_ServerlistType);
}
else else
{
RecheckOfficial();
LoadDDNetRanks(); LoadDDNetRanks();
}
return m_pDDNetInfo; return m_pDDNetInfo;
} }

View file

@ -86,6 +86,7 @@ public:
void RemoveFavorite(const NETADDR &Addr); void RemoveFavorite(const NETADDR &Addr);
void LoadDDNetRanks(); void LoadDDNetRanks();
void RecheckOfficial();
void LoadDDNetServers(); void LoadDDNetServers();
void LoadDDNetInfoJson(); void LoadDDNetInfoJson();
const json_value *LoadDDNetInfo(); const json_value *LoadDDNetInfo();