diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/server/cstrike/cs_team.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/server/cstrike/cs_team.cpp')
| -rw-r--r-- | game/server/cstrike/cs_team.cpp | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/game/server/cstrike/cs_team.cpp b/game/server/cstrike/cs_team.cpp new file mode 100644 index 0000000..61360ea --- /dev/null +++ b/game/server/cstrike/cs_team.cpp @@ -0,0 +1,101 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Team management class. Contains all the details for a specific team +// +// $NoKeywords: $ +//=============================================================================// +#include "cbase.h" +#include "cs_team.h" +#include "entitylist.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + + +// Datatable +IMPLEMENT_SERVERCLASS_ST(CCSTeam, DT_CSTeam) +END_SEND_TABLE() + +LINK_ENTITY_TO_CLASS( cs_team_manager, CCSTeam ); + +//----------------------------------------------------------------------------- +// Purpose: Get a pointer to the specified TF team manager +//----------------------------------------------------------------------------- +CCSTeam *GetGlobalTFTeam( int iIndex ) +{ + return (CCSTeam*)GetGlobalTeam( iIndex ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Needed because this is an entity, but should never be used +//----------------------------------------------------------------------------- +void CCSTeam::Init( const char *pName, int iNumber ) +{ + BaseClass::Init( pName, iNumber ); + + // Only detect changes every half-second. + NetworkProp()->SetUpdateInterval( 0.75f ); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +CCSTeam::~CCSTeam( void ) +{ +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CCSTeam::Precache( void ) +{ +} + + +//----------------------------------------------------------------------------- +// Purpose: Called every frame +//----------------------------------------------------------------------------- +void CCSTeam::Think( void ) +{ +} + + +//------------------------------------------------------------------------------------------------------------------ +// PLAYERS +//----------------------------------------------------------------------------- +// Purpose: Add the specified player to this team. Remove them from their current team, if any. +//----------------------------------------------------------------------------- +void CCSTeam::AddPlayer( CBasePlayer *pPlayer ) +{ + BaseClass::AddPlayer( pPlayer ); +} + +//----------------------------------------------------------------------------- +// Purpose: Clean up the player's objects when they leave +//----------------------------------------------------------------------------- +void CCSTeam::RemovePlayer( CBasePlayer *pPlayer ) +{ + BaseClass::RemovePlayer( pPlayer ); +} + +//------------------------------------------------------------------------------------------------------------------ +// UTILITY FUNCS +//----------------------------------------------------------------------------- + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +CCSTeam* CCSTeam::GetEnemyTeam() +{ + // Look for nearby enemy objects we can capture. + int iMyTeam = GetTeamNumber(); + if( iMyTeam == 0 ) + return NULL; + + int iEnemyTeam = !(iMyTeam - 1) + 1; + return (CCSTeam*)GetGlobalTeam( iEnemyTeam ); +} + + |