From 3dde666c159199e2a57bc2185508197526e348b5 Mon Sep 17 00:00:00 2001 From: m Date: Mon, 10 Oct 2022 13:10:40 -0500 Subject: [PATCH] unnecessary use of Dvar_FindVar --- src/client/component/dedicated.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/client/component/dedicated.cpp b/src/client/component/dedicated.cpp index a199913b..7dbca256 100644 --- a/src/client/component/dedicated.cpp +++ b/src/client/component/dedicated.cpp @@ -20,6 +20,8 @@ namespace dedicated utils::hook::detour gscr_set_dynamic_dvar_hook; utils::hook::detour com_quit_f_hook; + const game::dvar_t* sv_lanOnly; + void init_dedicated_server() { static bool initialized = false; @@ -32,8 +34,7 @@ namespace dedicated void send_heartbeat() { - auto* const dvar = game::Dvar_FindVar("sv_lanOnly"); - if (dvar && dvar->current.enabled) + if (sv_lanOnly->current.enabled) { return; } @@ -194,7 +195,7 @@ namespace dedicated dvars::register_bool("dedicated", true, game::DVAR_FLAG_READ, "Dedicated server"); // Add lanonly mode - dvars::register_bool("sv_lanOnly", false, game::DVAR_FLAG_NONE, "Don't send heartbeat"); + sv_lanOnly = dvars::register_bool("sv_lanOnly", false, game::DVAR_FLAG_NONE, "Don't send heartbeat"); // Disable VirtualLobby dvars::override::register_bool("virtualLobbyEnabled", false, game::DVAR_FLAG_READ);