Cache player IClient pointer on connect.
This commit is contained in:
parent
338fdb37f6
commit
c31eaa01a3
@ -1960,6 +1960,21 @@ void CPlayer::Initialize(const char *name, const char *ip, edict_t *pEntity)
|
|||||||
}
|
}
|
||||||
m_IpNoPort.assign(ip2);
|
m_IpNoPort.assign(ip2);
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE == SE_TF2 \
|
||||||
|
|| SOURCE_ENGINE == SE_CSS \
|
||||||
|
|| SOURCE_ENGINE == SE_DODS \
|
||||||
|
|| SOURCE_ENGINE == SE_HL2DM \
|
||||||
|
|| SOURCE_ENGINE == SE_BMS \
|
||||||
|
|| SOURCE_ENGINE == SE_INSURGENCY
|
||||||
|
m_pIClient = engine->GetIServer()->GetClient(m_iIndex - 1);
|
||||||
|
#else
|
||||||
|
INetChannel *pNetChan = static_cast<INetChannel *>(engine->GetPlayerNetInfo(m_iIndex));
|
||||||
|
if (pNetChan)
|
||||||
|
{
|
||||||
|
m_pIClient = static_cast<IClient *>(pNetChan->GetMsgHandler());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
UpdateAuthIds();
|
UpdateAuthIds();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2550,22 +2565,7 @@ int CPlayer::GetLifeState()
|
|||||||
|
|
||||||
IClient *CPlayer::GetIClient() const
|
IClient *CPlayer::GetIClient() const
|
||||||
{
|
{
|
||||||
#if SOURCE_ENGINE == SE_TF2 \
|
return m_pIClient;
|
||||||
|| SOURCE_ENGINE == SE_CSS \
|
|
||||||
|| SOURCE_ENGINE == SE_DODS \
|
|
||||||
|| SOURCE_ENGINE == SE_HL2DM \
|
|
||||||
|| SOURCE_ENGINE == SE_BMS \
|
|
||||||
|| SOURCE_ENGINE == SE_INSURGENCY
|
|
||||||
return engine->GetIServer()->GetClient(m_iIndex - 1);
|
|
||||||
#else
|
|
||||||
INetChannel *pNetChan = static_cast<INetChannel *>(engine->GetPlayerNetInfo(m_iIndex));
|
|
||||||
if (pNetChan)
|
|
||||||
{
|
|
||||||
return static_cast<IClient *>(pNetChan->GetMsgHandler());
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CPlayer::GetSerial()
|
unsigned int CPlayer::GetSerial()
|
||||||
|
@ -138,6 +138,7 @@ private:
|
|||||||
bool m_TempAdmin = false;
|
bool m_TempAdmin = false;
|
||||||
edict_t *m_pEdict = nullptr;
|
edict_t *m_pEdict = nullptr;
|
||||||
IPlayerInfo *m_Info = nullptr;
|
IPlayerInfo *m_Info = nullptr;
|
||||||
|
IClient *m_pIClient = nullptr;
|
||||||
String m_LastPassword;
|
String m_LastPassword;
|
||||||
bool m_bAdminCheckSignalled = false;
|
bool m_bAdminCheckSignalled = false;
|
||||||
int m_iIndex;
|
int m_iIndex;
|
||||||
|
Loading…
Reference in New Issue
Block a user