Fix CEngineClient::GetLocalPlayer()

Use VFTable method by index instead.
This commit is contained in:
Kawe Mazidjatari 2022-07-24 14:05:38 +02:00
parent 81374e8682
commit 65f8784e6e
2 changed files with 9 additions and 4 deletions

View File

@ -55,9 +55,14 @@ bool CEngineClient::GetRestrictClientCommands() const
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
// Purpose: get local player // Purpose: get local player
// Input : // Input :
// Output : void* (C_Player) // Output : int
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
void* CEngineClient::GetLocalPlayer() const int CEngineClient::GetLocalPlayer()
{ {
return CEngineClient_GetLocalPlayer(); #if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
const int index = 35;
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
const int index = 36;
#endif
return CallVFunc<int>(index, this);
} }

View File

@ -7,7 +7,7 @@ public:
bool GetRestrictServerCommands() const; bool GetRestrictServerCommands() const;
void SetRestrictClientCommands(bool bRestrict); void SetRestrictClientCommands(bool bRestrict);
bool GetRestrictClientCommands() const; bool GetRestrictClientCommands() const;
void* GetLocalPlayer() const; // Is actually C_Player. int GetLocalPlayer(); // Local player index.
}; };
/* ==== CVENGINECLIENT ================================================================================================================================================== */ /* ==== CVENGINECLIENT ================================================================================================================================================== */