Merge pull request #7852 from Robyt3/Browser-Community-Filter-Fix

Fix countries/types filters excluding all servers
This commit is contained in:
heinrich5991 2024-01-23 08:56:34 +00:00 committed by GitHub
commit a2c8869025
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View file

@ -1569,8 +1569,8 @@ void CServerBrowser::CommunitiesFilterClean()
void CServerBrowser::CountriesFilterClean()
{
std::vector<const char *> vpCountryNames;
for(const auto &Community : Communities())
for(const auto &Country : Community.Countries())
for(const CCommunity *pCommunity : SelectedCommunities())
for(const auto &Country : pCommunity->Countries())
vpCountryNames.push_back(Country.Name());
m_CountriesFilter.Clean(vpCountryNames);
}
@ -1578,8 +1578,8 @@ void CServerBrowser::CountriesFilterClean()
void CServerBrowser::TypesFilterClean()
{
std::vector<const char *> vpTypeNames;
for(const auto &Community : Communities())
for(const auto &Type : Community.Types())
for(const CCommunity *pCommunity : SelectedCommunities())
for(const auto &Type : pCommunity->Types())
vpTypeNames.push_back(Type.Name());
m_TypesFilter.Clean(vpTypeNames);
}

View file

@ -1743,7 +1743,6 @@ void CMenus::ConchainCommunitiesUpdate(IConsole::IResult *pResult, void *pUserDa
CMenus *pThis = static_cast<CMenus *>(pUserData);
if(pResult->NumArguments() >= 1 && (g_Config.m_UiPage == PAGE_INTERNET || g_Config.m_UiPage == PAGE_FAVORITES))
{
pThis->ServerBrowser()->CleanFilters();
pThis->UpdateCommunityCache(true);
pThis->Client()->ServerBrowserUpdate();
}
@ -1755,6 +1754,8 @@ void CMenus::UpdateCommunityCache(bool Force)
if(!Force && m_CommunityCache.m_UpdateTime != 0 && m_CommunityCache.m_UpdateTime == ServerBrowser()->DDNetInfoUpdateTime() && m_CommunityCache.m_PageWithCommunities == PageWithCommunities)
return;
ServerBrowser()->CleanFilters();
m_CommunityCache.m_UpdateTime = ServerBrowser()->DDNetInfoUpdateTime();
m_CommunityCache.m_PageWithCommunities = PageWithCommunities;