From 413e26b2aea07511b1cac68a633c38711b7b2938 Mon Sep 17 00:00:00 2001 From: m Date: Sat, 7 May 2022 08:23:26 -0500 Subject: [PATCH] fix visible server list refreshing --- src/Components/Modules/ServerList.cpp | 19 +++++++++++++++---- src/Components/Modules/ServerList.hpp | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Components/Modules/ServerList.cpp b/src/Components/Modules/ServerList.cpp index d6af313a..5bffcf9e 100644 --- a/src/Components/Modules/ServerList.cpp +++ b/src/Components/Modules/ServerList.cpp @@ -199,6 +199,11 @@ namespace Components } void ServerList::RefreshVisibleList(UIScript::Token) + { + ServerList::RefreshVisibleListInternal(UIScript::Token()); + } + + void ServerList::RefreshVisibleListInternal(UIScript::Token, bool refresh) { Dvar::Var("ui_serverSelected").set(false); @@ -207,6 +212,12 @@ namespace Components auto list = ServerList::GetList(); if (!list) return; + if (refresh) + { + ServerList::Refresh(UIScript::Token()); + return; + } + bool ui_browserShowFull = Dvar::Var("ui_browserShowFull").get(); bool ui_browserShowEmpty = Dvar::Var("ui_browserShowEmpty").get(); int ui_browserShowHardcore = Dvar::Var("ui_browserKillcam").get(); @@ -368,7 +379,7 @@ namespace Components auto list = ServerList::GetList(); if (list) list->clear(); - ServerList::RefreshVisibleList(UIScript::Token()); + ServerList::RefreshVisibleListInternal(UIScript::Token()); Game::ShowMessageBox("Server removed from favourites.", "Success"); } @@ -530,7 +541,7 @@ namespace Components if (lList) { lList->push_back(server); - ServerList::RefreshVisibleList(UIScript::Token()); + ServerList::RefreshVisibleListInternal(UIScript::Token()); } } @@ -693,7 +704,7 @@ namespace Components netSource.set(source); - ServerList::RefreshVisibleList(UIScript::Token()); + ServerList::RefreshVisibleListInternal(UIScript::Token(), true); } void ServerList::UpdateGameType() @@ -709,7 +720,7 @@ namespace Components joinGametype.set(gametype); - ServerList::RefreshVisibleList(UIScript::Token()); + ServerList::RefreshVisibleListInternal(UIScript::Token()); } void ServerList::UpdateVisibleInfo() diff --git a/src/Components/Modules/ServerList.hpp b/src/Components/Modules/ServerList.hpp index 22754f7b..51f7a062 100644 --- a/src/Components/Modules/ServerList.hpp +++ b/src/Components/Modules/ServerList.hpp @@ -35,6 +35,7 @@ namespace Components static void Refresh(UIScript::Token); static void RefreshVisibleList(UIScript::Token); + static void RefreshVisibleListInternal(UIScript::Token, bool refresh = false); static void UpdateVisibleList(UIScript::Token); static void InsertRequest(Network::Address address); static void Insert(Network::Address address, Utils::InfoString info);