core/PlayerManager.cpp
changeset 3502 2c1c30b50acc
parent 3460 ccd11f0c5372
child 3511 c9fd86b6bec3
     1.1 --- a/core/PlayerManager.cpp	Thu May 24 16:09:44 2012 +0100
     1.2 +++ b/core/PlayerManager.cpp	Thu May 24 17:55:46 2012 +0100
     1.3 @@ -116,6 +116,8 @@
     1.4  	m_SourceTVUserId = -1;
     1.5  	m_ReplayUserId = -1;
     1.6  
     1.7 +	m_bUseSteamAdminAuth = true; // use steam auth by default
     1.8 +
     1.9  	m_UserIdLookUp = new int[USHRT_MAX+1];
    1.10  	memset(m_UserIdLookUp, 0, sizeof(int) * (USHRT_MAX+1));
    1.11  }
    1.12 @@ -229,6 +231,17 @@
    1.13  			return ConfigResult_Reject;
    1.14  		}
    1.15  		return ConfigResult_Accept;
    1.16 +	} else if (strcmp( key, "SteamAuthstringValidation" ) == 0) {
    1.17 +		if (strcasecmp(value, "yes") == 0)
    1.18 +		{
    1.19 +			m_bUseSteamAdminAuth = true;
    1.20 +		} else if ( strcasecmp(value, "no") == 0) {
    1.21 +			m_bUseSteamAdminAuth = false;
    1.22 +		} else {
    1.23 +			UTIL_Format(error, maxlength, "Invalid value: must be \"yes\" or \"no\"");
    1.24 +			return ConfigResult_Reject;
    1.25 +		}
    1.26 +		return ConfigResult_Accept;
    1.27  	}
    1.28  	return ConfigResult_Ignore;
    1.29  }
    1.30 @@ -354,6 +367,18 @@
    1.31  	{
    1.32  		pPlayer = &m_Players[m_AuthQueue[i]];
    1.33  		authstr = engine->GetPlayerNetworkIDString(pPlayer->m_pEdict);
    1.34 +
    1.35 +#if SOURCE_ENGINE >= SE_ORANGEBOX
    1.36 +		// we can only easily check if the client is fully authed if we're on a recent engine
    1.37 +		if (m_bUseSteamAdminAuth && !g_HL2.IsLANServer())
    1.38 +		{
    1.39 +			if (!pPlayer->IsAuthedBySteam())
    1.40 +			{
    1.41 +				continue; // we're using steam auth, and steam doesn't know about this player yet so we can't do anything about them for now
    1.42 +			}
    1.43 +		}
    1.44 +#endif
    1.45 +
    1.46  		if (authstr && authstr[0] != '\0'
    1.47  			&& (strcmp(authstr, "STEAM_ID_PENDING") != 0))
    1.48  		{
    1.49 @@ -1632,6 +1657,13 @@
    1.50  	return m_IsAuthorized;
    1.51  }
    1.52  
    1.53 +#if SOURCE_ENGINE >= SE_ORANGEBOX
    1.54 +bool CPlayer::IsAuthedBySteam()
    1.55 +{
    1.56 +	return engine->IsClientFullyAuthenticated( m_pEdict );
    1.57 +}
    1.58 +#endif
    1.59 +
    1.60  IPlayerInfo *CPlayer::GetPlayerInfo()
    1.61  {
    1.62  	if (m_pEdict->GetUnknown())