unnecessary use of Dvar_FindVar

This commit is contained in:
m 2022-10-10 13:10:40 -05:00
parent 4e348abaf1
commit 3dde666c15

View File

@ -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);