diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /sp/src/game/server/team_spawnpoint.cpp | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'sp/src/game/server/team_spawnpoint.cpp')
| -rw-r--r-- | sp/src/game/server/team_spawnpoint.cpp | 266 |
1 files changed, 133 insertions, 133 deletions
diff --git a/sp/src/game/server/team_spawnpoint.cpp b/sp/src/game/server/team_spawnpoint.cpp index 39b172c9..ab3699e4 100644 --- a/sp/src/game/server/team_spawnpoint.cpp +++ b/sp/src/game/server/team_spawnpoint.cpp @@ -1,133 +1,133 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose: Team spawnpoint handling
-//
-// $NoKeywords: $
-//=============================================================================//
-#include "cbase.h"
-#include "entitylist.h"
-#include "entityoutput.h"
-#include "player.h"
-#include "eventqueue.h"
-#include "gamerules.h"
-#include "team_spawnpoint.h"
-#include "team.h"
-
-// memdbgon must be the last include file in a .cpp file!!!
-#include "tier0/memdbgon.h"
-
-LINK_ENTITY_TO_CLASS( info_player_teamspawn, CTeamSpawnPoint );
-
-BEGIN_DATADESC( CTeamSpawnPoint )
-
- // keys
- DEFINE_KEYFIELD( m_iDisabled, FIELD_INTEGER, "StartDisabled" ),
-
- // input functions
- DEFINE_INPUTFUNC( FIELD_VOID, "Enable", InputEnable ),
- DEFINE_INPUTFUNC( FIELD_VOID, "Disable", InputDisable ),
-
- // outputs
- DEFINE_OUTPUT( m_OnPlayerSpawn, "OnPlayerSpawn" ),
-
-END_DATADESC()
-
-
-//-----------------------------------------------------------------------------
-// Purpose: Attach this spawnpoint to it's team
-//-----------------------------------------------------------------------------
-void CTeamSpawnPoint::Activate( void )
-{
- BaseClass::Activate();
- if ( GetTeamNumber() > 0 && GetTeamNumber() <= MAX_TEAMS )
- {
- GetGlobalTeam( GetTeamNumber() )->AddSpawnpoint( this );
- }
- else
- {
- Warning( "info_player_teamspawn with invalid team number: %d\n", GetTeamNumber() );
- UTIL_Remove( this );
- }
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Is this spawnpoint ready for a player to spawn in?
-//-----------------------------------------------------------------------------
-bool CTeamSpawnPoint::IsValid( CBasePlayer *pPlayer )
-{
- CBaseEntity *ent = NULL;
- for ( CEntitySphereQuery sphere( GetAbsOrigin(), 128 ); ( ent = sphere.GetCurrentEntity() ) != NULL; sphere.NextEntity() )
- {
- // if ent is a client, don't spawn on 'em
- CBaseEntity *plent = ent;
- if ( plent && plent->IsPlayer() && plent != pPlayer )
- return false;
- }
-
- return true;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-void CTeamSpawnPoint::InputEnable( inputdata_t &inputdata )
-{
- m_iDisabled = FALSE;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-void CTeamSpawnPoint::InputDisable( inputdata_t &inputdata )
-{
- m_iDisabled = TRUE;
-}
-
-
-//===========================================================================================================
-// VEHICLE SPAWNPOINTS
-//===========================================================================================================
-LINK_ENTITY_TO_CLASS( info_vehicle_groundspawn, CTeamVehicleSpawnPoint );
-
-BEGIN_DATADESC( CTeamVehicleSpawnPoint )
-
- // outputs
- DEFINE_OUTPUT( m_OnVehicleSpawn, "OnVehicleSpawn" ),
-
-END_DATADESC()
-
-
-//-----------------------------------------------------------------------------
-// Purpose: Is this spawnpoint ready for a vehicle to spawn in?
-//-----------------------------------------------------------------------------
-bool CTeamVehicleSpawnPoint::IsValid( void )
-{
- CBaseEntity *ent = NULL;
- for ( CEntitySphereQuery sphere( GetAbsOrigin(), 128 ); ( ent = sphere.GetCurrentEntity() ) != NULL; sphere.NextEntity() )
- {
- // if ent is a client, don't spawn on 'em
- CBaseEntity *plent = ent;
- if ( plent && plent->IsPlayer() )
- return false;
- }
-
- return true;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Attach this spawnpoint to it's team
-//-----------------------------------------------------------------------------
-void CTeamVehicleSpawnPoint::Activate( void )
-{
- BaseClass::Activate();
- if ( GetTeamNumber() > 0 && GetTeamNumber() <= MAX_TEAMS )
- {
- // Don't add vehicle spawnpoints to the team for now
- //GetGlobalTeam( GetTeamNumber() )->AddSpawnpoint( this );
- }
- else
- {
- Warning( "info_vehicle_groundspawn with invalid team number: %d\n", GetTeamNumber() );
- UTIL_Remove( this );
- }
-}
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Team spawnpoint handling +// +// $NoKeywords: $ +//=============================================================================// +#include "cbase.h" +#include "entitylist.h" +#include "entityoutput.h" +#include "player.h" +#include "eventqueue.h" +#include "gamerules.h" +#include "team_spawnpoint.h" +#include "team.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +LINK_ENTITY_TO_CLASS( info_player_teamspawn, CTeamSpawnPoint ); + +BEGIN_DATADESC( CTeamSpawnPoint ) + + // keys + DEFINE_KEYFIELD( m_iDisabled, FIELD_INTEGER, "StartDisabled" ), + + // input functions + DEFINE_INPUTFUNC( FIELD_VOID, "Enable", InputEnable ), + DEFINE_INPUTFUNC( FIELD_VOID, "Disable", InputDisable ), + + // outputs + DEFINE_OUTPUT( m_OnPlayerSpawn, "OnPlayerSpawn" ), + +END_DATADESC() + + +//----------------------------------------------------------------------------- +// Purpose: Attach this spawnpoint to it's team +//----------------------------------------------------------------------------- +void CTeamSpawnPoint::Activate( void ) +{ + BaseClass::Activate(); + if ( GetTeamNumber() > 0 && GetTeamNumber() <= MAX_TEAMS ) + { + GetGlobalTeam( GetTeamNumber() )->AddSpawnpoint( this ); + } + else + { + Warning( "info_player_teamspawn with invalid team number: %d\n", GetTeamNumber() ); + UTIL_Remove( this ); + } +} + +//----------------------------------------------------------------------------- +// Purpose: Is this spawnpoint ready for a player to spawn in? +//----------------------------------------------------------------------------- +bool CTeamSpawnPoint::IsValid( CBasePlayer *pPlayer ) +{ + CBaseEntity *ent = NULL; + for ( CEntitySphereQuery sphere( GetAbsOrigin(), 128 ); ( ent = sphere.GetCurrentEntity() ) != NULL; sphere.NextEntity() ) + { + // if ent is a client, don't spawn on 'em + CBaseEntity *plent = ent; + if ( plent && plent->IsPlayer() && plent != pPlayer ) + return false; + } + + return true; +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CTeamSpawnPoint::InputEnable( inputdata_t &inputdata ) +{ + m_iDisabled = FALSE; +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CTeamSpawnPoint::InputDisable( inputdata_t &inputdata ) +{ + m_iDisabled = TRUE; +} + + +//=========================================================================================================== +// VEHICLE SPAWNPOINTS +//=========================================================================================================== +LINK_ENTITY_TO_CLASS( info_vehicle_groundspawn, CTeamVehicleSpawnPoint ); + +BEGIN_DATADESC( CTeamVehicleSpawnPoint ) + + // outputs + DEFINE_OUTPUT( m_OnVehicleSpawn, "OnVehicleSpawn" ), + +END_DATADESC() + + +//----------------------------------------------------------------------------- +// Purpose: Is this spawnpoint ready for a vehicle to spawn in? +//----------------------------------------------------------------------------- +bool CTeamVehicleSpawnPoint::IsValid( void ) +{ + CBaseEntity *ent = NULL; + for ( CEntitySphereQuery sphere( GetAbsOrigin(), 128 ); ( ent = sphere.GetCurrentEntity() ) != NULL; sphere.NextEntity() ) + { + // if ent is a client, don't spawn on 'em + CBaseEntity *plent = ent; + if ( plent && plent->IsPlayer() ) + return false; + } + + return true; +} + +//----------------------------------------------------------------------------- +// Purpose: Attach this spawnpoint to it's team +//----------------------------------------------------------------------------- +void CTeamVehicleSpawnPoint::Activate( void ) +{ + BaseClass::Activate(); + if ( GetTeamNumber() > 0 && GetTeamNumber() <= MAX_TEAMS ) + { + // Don't add vehicle spawnpoints to the team for now + //GetGlobalTeam( GetTeamNumber() )->AddSpawnpoint( this ); + } + else + { + Warning( "info_vehicle_groundspawn with invalid team number: %d\n", GetTeamNumber() ); + UTIL_Remove( this ); + } +} |