From 00ac17c9015a8f82109a1c52ea51fa79fb1fb15e Mon Sep 17 00:00:00 2001 From: m Date: Tue, 3 May 2022 02:01:54 -0500 Subject: [PATCH] remove useless dvar fetching --- src/Components/Modules/ServerList.cpp | 9 +++------ src/Components/Modules/ServerList.hpp | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Components/Modules/ServerList.cpp b/src/Components/Modules/ServerList.cpp index d190809f..1b8bf202 100644 --- a/src/Components/Modules/ServerList.cpp +++ b/src/Components/Modules/ServerList.cpp @@ -273,7 +273,7 @@ namespace Components const auto masterServerName = Dvar::Var("masterServerName").get(); Game::netadr_t masterServerAddr; - if (ServerList::GetMasterServer(masterServerAddr)) + if (ServerList::GetMasterServer(masterServerName, masterPort, masterServerAddr)) { Toast::Show("cardicon_headshot", "Server Browser", "Fetching servers...", 3000); useMasterServer = true; @@ -738,12 +738,9 @@ namespace Components } } - bool ServerList::GetMasterServer(Game::netadr_t& address) + bool ServerList::GetMasterServer(const char* ip, int port, Game::netadr_t& address) { - auto masterPort = Dvar::Var("masterPort").get(); - auto masterServerName = Dvar::Var("masterServerName").get(); - - return Game::NET_StringToAdr(Utils::String::VA("%s:%u", masterServerName, masterPort), &address); + return Game::NET_StringToAdr(Utils::String::VA("%s:%u", ip, port), &address); } bool ServerList::IsServerListOpen() diff --git a/src/Components/Modules/ServerList.hpp b/src/Components/Modules/ServerList.hpp index 98c927a9..22754f7b 100644 --- a/src/Components/Modules/ServerList.hpp +++ b/src/Components/Modules/ServerList.hpp @@ -50,7 +50,7 @@ namespace Components static void UpdateVisibleInfo(); - static bool GetMasterServer(Game::netadr_t& address); + static bool GetMasterServer(const char* ip, int port, Game::netadr_t& address); static bool useMasterServer; private: