@@ -2008,49 +2008,8 @@ void CPlayer::Connect()
2008
2008
2009
2009
void CPlayer::UpdateAuthIds ()
2010
2010
{
2011
- if (m_IsAuthorized)
2012
- {
2013
- return ;
2014
- }
2015
-
2016
- // First cache engine networkid
2017
- const char *authstr = engine->GetPlayerNetworkIDString (m_pEdict);
2018
- if (!authstr)
2019
- {
2020
- // engine doesn't have the client's auth string just yet, we can't do anything
2021
- return ;
2022
- }
2023
-
2024
- if (m_AuthID.compare (authstr) == 0 )
2025
- {
2011
+ if (m_IsAuthorized || (!SetEngineString () && !SetCSteamID ()))
2026
2012
return ;
2027
- }
2028
-
2029
- m_AuthID = authstr;
2030
-
2031
- // Then, cache SteamId
2032
- if (IsFakeClient ())
2033
- {
2034
- m_SteamId = k_steamIDNil;
2035
- }
2036
- else
2037
- {
2038
- #if SOURCE_ENGINE < SE_ORANGEBOX
2039
- const char * pAuth = GetAuthString ();
2040
- /* STEAM_0:1:123123 | STEAM_ID_LAN | STEAM_ID_PENDING */
2041
- if (pAuth && (strlen (pAuth) > 10 ) && pAuth[8 ] != ' _' )
2042
- {
2043
- m_SteamId = CSteamID (atoi (&pAuth[8 ]) | (atoi (&pAuth[10 ]) << 1 ),
2044
- k_unSteamUserDesktopInstance, k_EUniversePublic, k_EAccountTypeIndividual);
2045
- }
2046
- #else
2047
- const CSteamID *steamId = engine->GetClientSteamID (m_pEdict);
2048
- if (steamId)
2049
- {
2050
- m_SteamId = (*steamId);
2051
- }
2052
- #endif
2053
- }
2054
2013
2055
2014
// Now cache Steam2/3 rendered ids
2056
2015
if (IsFakeClient ())
@@ -2102,6 +2061,53 @@ void CPlayer::UpdateAuthIds()
2102
2061
m_Steam3Id = szAuthBuffer;
2103
2062
}
2104
2063
2064
+ bool CPlayer::SetEngineString ()
2065
+ {
2066
+ const char *authstr = engine->GetPlayerNetworkIDString (m_pEdict);
2067
+ if (!authstr || m_AuthID.compare (authstr) == 0 )
2068
+ return false ;
2069
+
2070
+ m_AuthID = authstr;
2071
+ SetCSteamID ();
2072
+ return true ;
2073
+ }
2074
+
2075
+ bool CPlayer::SetCSteamID ()
2076
+ {
2077
+ if (IsFakeClient ())
2078
+ {
2079
+ m_SteamId = k_steamIDNil;
2080
+ return true ; /* This is the default value. There's a bug-out branch in the caller function. */
2081
+ }
2082
+
2083
+ #if SOURCE_ENGINE < SE_ORANGEBOX
2084
+ const char *pAuth = GetAuthString ();
2085
+ /* STEAM_0:1:123123 | STEAM_ID_LAN | STEAM_ID_PENDING */
2086
+ if (pAuth && (strlen (pAuth) > 10 ) && pAuth[8 ] != ' _' )
2087
+ {
2088
+ CSteamID sid = CSteamID (atoi (&pAuth[8 ]) | (atoi (&pAuth[10 ]) << 1 ),
2089
+ k_unSteamUserDesktopInstance, k_EUniversePublic, k_EAccountTypeIndividual);
2090
+
2091
+ if (m_SteamId != sid)
2092
+ {
2093
+ m_SteamId = sid;
2094
+ return true ;
2095
+ }
2096
+ }
2097
+ #else
2098
+ const CSteamID *steamId = engine->GetClientSteamID (m_pEdict);
2099
+ if (steamId)
2100
+ {
2101
+ if (m_SteamId != (*steamId))
2102
+ {
2103
+ m_SteamId = (*steamId);
2104
+ return true ;
2105
+ }
2106
+ }
2107
+ #endif
2108
+ return false ;
2109
+ }
2110
+
2105
2111
// Ensure a valid AuthString is set before calling.
2106
2112
void CPlayer::Authorize ()
2107
2113
{
0 commit comments