fix visible server list refreshing

This commit is contained in:
m 2022-05-07 08:23:26 -05:00
parent c99b6b058f
commit 413e26b2ae
2 changed files with 16 additions and 4 deletions

View File

@ -199,6 +199,11 @@ namespace Components
} }
void ServerList::RefreshVisibleList(UIScript::Token) void ServerList::RefreshVisibleList(UIScript::Token)
{
ServerList::RefreshVisibleListInternal(UIScript::Token());
}
void ServerList::RefreshVisibleListInternal(UIScript::Token, bool refresh)
{ {
Dvar::Var("ui_serverSelected").set(false); Dvar::Var("ui_serverSelected").set(false);
@ -207,6 +212,12 @@ namespace Components
auto list = ServerList::GetList(); auto list = ServerList::GetList();
if (!list) return; if (!list) return;
if (refresh)
{
ServerList::Refresh(UIScript::Token());
return;
}
bool ui_browserShowFull = Dvar::Var("ui_browserShowFull").get<bool>(); bool ui_browserShowFull = Dvar::Var("ui_browserShowFull").get<bool>();
bool ui_browserShowEmpty = Dvar::Var("ui_browserShowEmpty").get<bool>(); bool ui_browserShowEmpty = Dvar::Var("ui_browserShowEmpty").get<bool>();
int ui_browserShowHardcore = Dvar::Var("ui_browserKillcam").get<int>(); int ui_browserShowHardcore = Dvar::Var("ui_browserKillcam").get<int>();
@ -368,7 +379,7 @@ namespace Components
auto list = ServerList::GetList(); auto list = ServerList::GetList();
if (list) list->clear(); if (list) list->clear();
ServerList::RefreshVisibleList(UIScript::Token()); ServerList::RefreshVisibleListInternal(UIScript::Token());
Game::ShowMessageBox("Server removed from favourites.", "Success"); Game::ShowMessageBox("Server removed from favourites.", "Success");
} }
@ -530,7 +541,7 @@ namespace Components
if (lList) if (lList)
{ {
lList->push_back(server); lList->push_back(server);
ServerList::RefreshVisibleList(UIScript::Token()); ServerList::RefreshVisibleListInternal(UIScript::Token());
} }
} }
@ -693,7 +704,7 @@ namespace Components
netSource.set(source); netSource.set(source);
ServerList::RefreshVisibleList(UIScript::Token()); ServerList::RefreshVisibleListInternal(UIScript::Token(), true);
} }
void ServerList::UpdateGameType() void ServerList::UpdateGameType()
@ -709,7 +720,7 @@ namespace Components
joinGametype.set(gametype); joinGametype.set(gametype);
ServerList::RefreshVisibleList(UIScript::Token()); ServerList::RefreshVisibleListInternal(UIScript::Token());
} }
void ServerList::UpdateVisibleInfo() void ServerList::UpdateVisibleInfo()

View File

@ -35,6 +35,7 @@ namespace Components
static void Refresh(UIScript::Token); static void Refresh(UIScript::Token);
static void RefreshVisibleList(UIScript::Token); static void RefreshVisibleList(UIScript::Token);
static void RefreshVisibleListInternal(UIScript::Token, bool refresh = false);
static void UpdateVisibleList(UIScript::Token); static void UpdateVisibleList(UIScript::Token);
static void InsertRequest(Network::Address address); static void InsertRequest(Network::Address address);
static void Insert(Network::Address address, Utils::InfoString info); static void Insert(Network::Address address, Utils::InfoString info);