Merge pull request #459 from diamante0018/develop

remove useless dvar lookup
This commit is contained in:
Maurice Heumann 2022-10-10 08:20:29 +02:00 committed by GitHub
commit e26004aa09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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