Skip to content

Commit

Permalink
Add bad hack to add backcompat for new SteamID rendering changes in T…
Browse files Browse the repository at this point in the history
…F2 and later others.
  • Loading branch information
psychonic committed Aug 22, 2014
1 parent 6123c5e commit dfcf953
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions core/PlayerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
#include "logic_bridge.h"
#include <sourcemod_version.h>

#if SOURCE_ENGINE >= SE_ORANGEBOX
#include <steam/steamclientpublic.h>
#endif

class CSteamID;

PlayerManager g_Players;
bool g_OnMapStarted = false;
IForward *PreAdminCheck = NULL;
Expand Down Expand Up @@ -399,15 +405,28 @@ void PlayerManager::RunAuthChecks()
{
CPlayer *pPlayer;
const char *authstr;
const CSteamID *steamid = NULL;
unsigned int removed = 0;
for (unsigned int i=1; i<=m_AuthQueue[0]; i++)
{
pPlayer = &m_Players[m_AuthQueue[i]];
#if SOURCE_ENGINE == SE_DOTA
steamid = engine->GetClientSteamID(pPlayer->m_iIndex);
authstr = engine->GetPlayerNetworkIDString(pPlayer->m_iIndex - 1);
#elif SOURCE_ENGINE >= SE_ORANGEBOX
steamid = engine->GetClientSteamID(pPlayer->m_pEdict);
authstr = engine->GetPlayerNetworkIDString(pPlayer->m_pEdict);
#else
authstr = engine->GetPlayerNetworkIDString(pPlayer->m_pEdict);
#endif

#if SOURCE_ENGINE >= SE_ORANGEBOX
if (authstr && authstr[0] == '[' && steamid)
{
authstr = steamid->Render();
}
#endif

pPlayer->SetAuthString(authstr);

if (!pPlayer->IsAuthStringValidated())
Expand Down Expand Up @@ -2436,3 +2455,28 @@ void CPlayer::PrintToConsole(const char *pMsg)
engine->ClientPrintf(m_pEdict, pMsg);
#endif
}

#if SOURCE_ENGINE >= SE_LEFT4DEAD
const EUniverse kCurrentSteamUniverse = k_EUniversePublic;
#elif SOURCE_ENGINE >= SE_ORANGEBOX
const EUniverse kCurrentSteamUniverse = k_EUniverseInvalid;
#endif

#if SOURCE_ENGINE >= SE_ORANGEBOX
const char *CSteamID::Render() const
{
static char szSteamID[64];

switch (GetEAccountType())
{
case k_EAccountTypeInvalid:
case k_EAccountTypeIndividual:
snprintf(szSteamID, sizeof(szSteamID), "STEAM_%u:%u:%u", kCurrentSteamUniverse, GetAccountID() % 2, GetAccountID() << 1);
break;
default:
szSteamID[0] = '\0';
}

return szSteamID;
}
#endif

0 comments on commit dfcf953

Please sign in to comment.