source-engine/game/server/team.h

102 lines
3.2 KiB
C
Raw Normal View History

2020-04-22 16:56:21 +00:00
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Team management class. Contains all the details for a specific team
//
// $NoKeywords: $
//=============================================================================//
#ifndef TEAM_H
#define TEAM_H
#ifdef _WIN32
#pragma once
#endif
#include "shareddefs.h"
#include "utlvector.h"
class CBasePlayer;
class CTeamSpawnPoint;
class CTeam : public CBaseEntity
{
DECLARE_CLASS( CTeam, CBaseEntity );
public:
CTeam( void );
virtual ~CTeam( void );
DECLARE_SERVERCLASS();
virtual void Precache( void ) { return; };
virtual void Think( void );
virtual int UpdateTransmitState( void );
//-----------------------------------------------------------------------------
// Initialization
//-----------------------------------------------------------------------------
virtual void Init( const char *pName, int iNumber );
//-----------------------------------------------------------------------------
// Data Handling
//-----------------------------------------------------------------------------
virtual int GetTeamNumber( void ) const;
2022-03-01 20:00:42 +00:00
virtual const char *GetName( void );
2020-04-22 16:56:21 +00:00
virtual void UpdateClientData( CBasePlayer *pPlayer );
2022-03-01 20:00:42 +00:00
virtual bool ShouldTransmitToPlayer( CBasePlayer* pRecipient, CBaseEntity* pEntity );
2020-04-22 16:56:21 +00:00
//-----------------------------------------------------------------------------
// Spawnpoints
//-----------------------------------------------------------------------------
virtual void InitializeSpawnpoints( void );
virtual void AddSpawnpoint( CTeamSpawnPoint *pSpawnpoint );
virtual void RemoveSpawnpoint( CTeamSpawnPoint *pSpawnpoint );
virtual CBaseEntity *SpawnPlayer( CBasePlayer *pPlayer );
//-----------------------------------------------------------------------------
// Players
//-----------------------------------------------------------------------------
virtual void InitializePlayers( void );
virtual void AddPlayer( CBasePlayer *pPlayer );
virtual void RemovePlayer( CBasePlayer *pPlayer );
2022-03-01 20:00:42 +00:00
virtual int GetNumPlayers( void );
virtual CBasePlayer *GetPlayer( int iIndex );
2020-04-22 16:56:21 +00:00
//-----------------------------------------------------------------------------
// Scoring
//-----------------------------------------------------------------------------
virtual void AddScore( int iScore );
virtual void SetScore( int iScore );
2022-03-01 20:00:42 +00:00
virtual int GetScore( void );
2020-04-22 16:56:21 +00:00
virtual void ResetScores( void );
// Round scoring
2022-03-01 20:00:42 +00:00
virtual int GetRoundsWon( void ) { return m_iRoundsWon; }
2020-04-22 16:56:21 +00:00
virtual void SetRoundsWon( int iRounds ) { m_iRoundsWon = iRounds; }
virtual void IncrementRoundsWon( void ) { m_iRoundsWon++; }
void AwardAchievement( int iAchievement );
2022-03-01 20:00:42 +00:00
virtual int GetAliveMembers( void );
2020-04-22 16:56:21 +00:00
public:
CUtlVector< CTeamSpawnPoint * > m_aSpawnPoints;
CUtlVector< CBasePlayer * > m_aPlayers;
// Data
CNetworkString( m_szTeamname, MAX_TEAM_NAME_LENGTH );
CNetworkVar( int, m_iScore );
CNetworkVar( int, m_iRoundsWon );
int m_iDeaths;
// Spawnpoints
int m_iLastSpawn; // Index of the last spawnpoint used
CNetworkVar( int, m_iTeamNum ); // Which team is this?
};
extern CUtlVector< CTeam * > g_Teams;
extern CTeam *GetGlobalTeam( int iIndex );
extern int GetNumberOfTeams( void );
#endif // TEAM_H