diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-10-23 18:02:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-23 18:02:55 +0100 |
commit | f233b4b75b974ade00aa94436bd39c9b3f9321bd (patch) | |
tree | bc4da898a05459c84417f9ab9a46bb7d6be7b06f | |
parent | 6bca5d1db5cb0714d1cb8d39c8fcf6ebda77e63e (diff) | |
download | NorthstarLauncher-f233b4b75b974ade00aa94436bd39c9b3f9321bd.tar.gz NorthstarLauncher-f233b4b75b974ade00aa94436bd39c9b3f9321bd.zip |
fix reading of cvar net_data_block_enabled (#302)v1.10.1-rc1v1.10.1
-rw-r--r-- | NorthstarDLL/limits.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/NorthstarDLL/limits.cpp b/NorthstarDLL/limits.cpp index fd635136..c254de52 100644 --- a/NorthstarDLL/limits.cpp +++ b/NorthstarDLL/limits.cpp @@ -13,8 +13,6 @@ AUTOHOOK_INIT() ServerLimitsManager* g_pServerLimits; -ConVar* Cvar_net_datablock_enabled; - // todo: make this work on higher timescales, also possibly disable when sv_cheats is set void ServerLimitsManager::RunFrame(double flCurrentTime, float flFrameTime) { @@ -148,8 +146,11 @@ AUTOHOOK(ProcessConnectionlessPacket, engine.dll + 0x117800, bool, , (void* a1, R2::netpacket_t* packet)) // clang-format on { + static const ConVar* Cvar_net_data_block_enabled = R2::g_pCVar->FindVar("net_data_block_enabled"); + + // don't ratelimit datablock packets as long as datablock is enabled if (packet->adr.type == R2::NA_IP && - (!(packet->data[4] == 'N' && Cvar_net_datablock_enabled->GetBool()) || !Cvar_net_datablock_enabled->GetBool())) + (!(packet->data[4] == 'N' && Cvar_net_data_block_enabled->GetBool()) || !Cvar_net_data_block_enabled->GetBool())) { // bad lookup: optimise later tm UnconnectedPlayerLimitData* sendData = nullptr; @@ -289,8 +290,6 @@ ON_DLL_LOAD_RELIESON("engine.dll", ServerLimits, ConVar, (CModule module)) "1.2", FCVAR_GAMEDLL, "Increase usercmd processing budget by tickinterval * value per tick"); - - Cvar_net_datablock_enabled = R2::g_pCVar->FindVar("net_datablock_enabled"); } ON_DLL_LOAD("server.dll", ServerLimitsServer, (CModule module)) |