remove useless dvar lookup

This commit is contained in:
FutureRave 2022-10-10 04:52:34 +01:00
parent 1d00bbce5c
commit 3a7d9018e1
No known key found for this signature in database
GPG Key ID: 22F9079C86CFAB31

View File

@ -17,6 +17,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;
@ -29,8 +31,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;
}
@ -175,11 +176,9 @@ namespace dedicated
return;
}
// Register dedicated dvar
game::Dvar_RegisterBool("dedicated", true, game::DVAR_FLAG_READ, "Dedicated server");
// Add lanonly mode
game::Dvar_RegisterBool("sv_lanOnly", false, game::DVAR_FLAG_NONE, "Don't send heartbeat");
sv_lanOnly = game::Dvar_RegisterBool("sv_lanOnly", false, game::DVAR_FLAG_NONE, "Don't send heartbeat");
// Disable VirtualLobby
dvars::override::Dvar_RegisterBool("virtualLobbyEnabled", false, game::DVAR_FLAG_NONE | game::DVAR_FLAG_READ);