From 98f09b25de3213c87368d9273b4782e6a8033569 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 30 Apr 2023 01:26:37 +0200 Subject: [PATCH] CClient: Member type improvements * Made 'm_nUserID' signed. --- r5dev/engine/client/client.cpp | 15 ++++++++++----- r5dev/engine/client/client.h | 8 ++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/r5dev/engine/client/client.cpp b/r5dev/engine/client/client.cpp index a3a228e1..a9af2893 100644 --- a/r5dev/engine/client/client.cpp +++ b/r5dev/engine/client/client.cpp @@ -25,7 +25,7 @@ CClient* CClient::GetClient(int nIndex) const //--------------------------------------------------------------------------------- // Purpose: gets the client's team number //--------------------------------------------------------------------------------- -__int64 CClient::GetTeamNum() const +int64_t CClient::GetTeamNum() const { return m_iTeamNum; } @@ -41,7 +41,7 @@ edict_t CClient::GetHandle(void) const //--------------------------------------------------------------------------------- // Purpose: gets the userID of this client //--------------------------------------------------------------------------------- -uint32_t CClient::GetUserID(void) const +int CClient::GetUserID(void) const { return m_nUserID; } @@ -339,7 +339,9 @@ bool CClient::VProcessStringCmd(CClient* pClient, NET_StringCmd* pMsg) char* pShifted = reinterpret_cast(pClient) - 8; CClient* pClient_Adj = reinterpret_cast(pShifted); #endif // !GAMEDLL_S0 || !GAMEDLL_S1 - ServerPlayer_t* pSlot = &g_ServerPlayer[pClient_Adj->GetUserID()]; + int nUserID = pClient_Adj->GetUserID(); + ServerPlayer_t* pSlot = &g_ServerPlayer[nUserID]; + double flStartTime = Plat_FloatTime(); int nCmdQuotaLimit = sv_quota_stringCmdsPerSecond->GetInt(); @@ -355,10 +357,13 @@ bool CClient::VProcessStringCmd(CClient* pClient, NET_StringCmd* pMsg) if (pSlot->m_nStringCommandQuotaCount > nCmdQuotaLimit) { - Warning(eDLL_T::SERVER, "Removing client '%s' from slot '%i' ('%llu' exceeded string command quota!)\n", - pClient_Adj->GetNetChan()->GetAddress(), pClient_Adj->GetUserID(), pClient_Adj->GetNucleusID()); + const char* pszAddress = pClient_Adj->GetNetChan()->GetAddress(); + const uint64_t nNucleusID = pClient_Adj->GetNucleusID(); pClient_Adj->Disconnect(Reputation_t::REP_MARK_BAD, "#DISCONNECT_STRINGCMD_OVERFLOW"); + + Warning(eDLL_T::SERVER, "Removed client '%s' from slot #%i ('%llu' exceeded string command quota!)\n", + pszAddress, nUserID, nNucleusID); return true; } #endif // !CLIENT_DLL diff --git a/r5dev/engine/client/client.h b/r5dev/engine/client/client.h index 50a9ce3e..9aabb31d 100644 --- a/r5dev/engine/client/client.h +++ b/r5dev/engine/client/client.h @@ -62,9 +62,9 @@ class CClient : IClientMessageHandler, INetChannelHandler { public: CClient* GetClient(int nIndex) const; - __int64 GetTeamNum() const; + int64_t GetTeamNum() const; edict_t GetHandle(void) const; - uint32_t GetUserID(void) const; + int GetUserID(void) const; uint64_t GetNucleusID(void) const; SIGNONSTATE GetSignonState(void) const; PERSISTENCE GetPersistenceState(void) const; @@ -99,14 +99,14 @@ public: // Hook statics: static void* VSendSnapshot(CClient* pClient, CClientFrame* pFrame, int nTick, int nTickAck); private: - uint32_t m_nUserID; //0x0010 + int m_nUserID; //0x0010 edict_t m_nHandle; //0x0014 char m_szServerName[256]; //0x0160 char m_szClientName[256]; //0x0116 char pad_0015[258]; //0x0216 int m_nCommandTick; //0x0318 char pad_031C[60]; //0x031C - __int64 m_iTeamNum; //0x0258 + int64_t m_iTeamNum; //0x0258 KeyValues* m_ConVars; //0x0360 char pad_0368[8]; //0x0368 CServer* m_pServer; //0x0370