CClient: Member type improvements

* Made 'm_nUserID' signed.
This commit is contained in:
Kawe Mazidjatari 2023-04-30 01:26:37 +02:00
parent 4ec8e67d9b
commit 98f09b25de
2 changed files with 14 additions and 9 deletions

View File

@ -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<char*>(pClient) - 8;
CClient* pClient_Adj = reinterpret_cast<CClient*>(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

View File

@ -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