aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/server/auth
diff options
context:
space:
mode:
authorBobTheBob9 <for.oliver.kirkham@gmail.com>2023-01-08 02:10:48 +0000
committerBobTheBob9 <for.oliver.kirkham@gmail.com>2023-01-08 02:10:48 +0000
commitb78f7dc3f9b277c22843cc289346fc68b29fc087 (patch)
tree31b7bffb57bba8cbac5bc4eb82a92e5ab53fc7c4 /NorthstarDLL/server/auth
parentb56684cd86eeb21ff2a4008938286ff7d593a544 (diff)
downloadNorthstarLauncher-b78f7dc3f9b277c22843cc289346fc68b29fc087.tar.gz
NorthstarLauncher-b78f7dc3f9b277c22843cc289346fc68b29fc087.zip
assign bot teams and fix issue with bot_add occasionally not workin
Diffstat (limited to 'NorthstarDLL/server/auth')
-rw-r--r--NorthstarDLL/server/auth/serverauthentication.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/NorthstarDLL/server/auth/serverauthentication.cpp b/NorthstarDLL/server/auth/serverauthentication.cpp
index c6283b7a..7b3f7436 100644
--- a/NorthstarDLL/server/auth/serverauthentication.cpp
+++ b/NorthstarDLL/server/auth/serverauthentication.cpp
@@ -399,6 +399,27 @@ void,, (R2::CBaseClient* self, uint32_t unknownButAlways1, const char* pReason,
_CBaseClient__Disconnect(self, unknownButAlways1, buf);
}
+// clang-format off
+AUTOHOOK(CBaseClient__Clear, engine.dll + 0x101480,
+ void, __fastcall, (R2::CBaseClient* self))
+// clang-format on
+{
+ // final cleanup, humans should never hit this without being disconnected already!
+ // bots generally will on level change, however, so this is necessary
+ if (g_pServerAuthentication->m_PlayerAuthenticationData.find(self) != g_pServerAuthentication->m_PlayerAuthenticationData.end())
+ {
+ if (!self->m_bFakePlayer)
+ spdlog::warn("player {} has auth data in CBaseClient::Clear()!");
+
+ // fully cleanup
+ g_pServerAuthentication->RemovePlayerAuthData(self);
+ g_pServerAuthentication->RemovePlayer(self);
+ g_pServerLimits->RemovePlayer(self);
+ }
+
+ CBaseClient__Clear(self);
+}
+
void ConCommand_ns_resetpersistence(const CCommand& args)
{
if (*R2::g_pServerState == R2::server_state_t::ss_active)