From dfcf953131b03b3f58d4a188e203574505d2782a Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Thu, 21 Aug 2014 20:10:17 -0400 Subject: [PATCH 1/2] Add bad hack to add backcompat for new SteamID rendering changes in TF2 and later others. --- core/PlayerManager.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/core/PlayerManager.cpp b/core/PlayerManager.cpp index bc2c1038..d543e3c4 100644 --- a/core/PlayerManager.cpp +++ b/core/PlayerManager.cpp @@ -47,6 +47,12 @@ #include "logic_bridge.h" #include +#if SOURCE_ENGINE >= SE_ORANGEBOX +#include +#endif + +class CSteamID; + PlayerManager g_Players; bool g_OnMapStarted = false; IForward *PreAdminCheck = NULL; @@ -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()) @@ -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 From 7585acaeefe99b893c8e15c4694d6c89be808dd0 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Thu, 21 Aug 2014 20:20:12 -0400 Subject: [PATCH 2/2] << >> --- core/PlayerManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/PlayerManager.cpp b/core/PlayerManager.cpp index d543e3c4..ffcfdd9c 100644 --- a/core/PlayerManager.cpp +++ b/core/PlayerManager.cpp @@ -2471,7 +2471,7 @@ const char *CSteamID::Render() const { case k_EAccountTypeInvalid: case k_EAccountTypeIndividual: - snprintf(szSteamID, sizeof(szSteamID), "STEAM_%u:%u:%u", kCurrentSteamUniverse, GetAccountID() % 2, GetAccountID() << 1); + snprintf(szSteamID, sizeof(szSteamID), "STEAM_%u:%u:%u", kCurrentSteamUniverse, GetAccountID() % 2, GetAccountID() >> 1); break; default: szSteamID[0] = '\0';