GetPlayerNetworkIDString isn't alone anymore, we have friends. (#551)

* GetPlayerNetworkIDString isn't alone anymore, we have friends.

Completely speculative CS:GO fix, 50/50, 60/40.

* Preserve existing cycle-saving techniques.
* Style.
This commit is contained in:
Kyle Sanderson 2016-10-13 22:14:51 -07:00 committed by GitHub
parent 9158d3734e
commit 20b7592fcd

View File

@ -2012,30 +2012,27 @@ void CPlayer::UpdateAuthIds()
{
return;
}
// First cache engine networkid
const char *authstr = engine->GetPlayerNetworkIDString(m_pEdict);
if (!authstr)
if (authstr)
{
// engine doesn't have the client's auth string just yet, we can't do anything
return;
if (m_AuthID.compare(authstr) != 0)
{
m_AuthID = authstr;
}
else
{
return;
}
}
if (m_AuthID.compare(authstr) == 0)
{
return;
}
m_AuthID = authstr;
// Then, cache SteamId
if (IsFakeClient())
{
m_SteamId = k_steamIDNil;
}
else
{
#if SOURCE_ENGINE < SE_ORANGEBOX || SOURCE_ENGINE == SE_CSGO
#if SOURCE_ENGINE < SE_ORANGEBOX
const char * pAuth = GetAuthString();
/* STEAM_0:1:123123 | STEAM_ID_LAN | STEAM_ID_PENDING */
if (pAuth && (strlen(pAuth) > 10) && pAuth[8] != '_')
@ -2047,7 +2044,14 @@ void CPlayer::UpdateAuthIds()
const CSteamID *steamId = engine->GetClientSteamID(m_pEdict);
if (steamId)
{
m_SteamId = (*steamId);
if (m_SteamId != (*steamId))
{
m_SteamId = (*steamId);
}
else
{
return;
}
}
#endif
}