Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
5.4 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Team management class. Contains all the details for a specific team
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef TEAM_H
  8. #define TEAM_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "shareddefs.h"
  13. #include "utlvector.h"
  14. #include "cs_player.h"
  15. class CBasePlayer;
  16. class CTeamSpawnPoint;
  17. class CTeam : public CBaseEntity
  18. {
  19. DECLARE_CLASS( CTeam, CBaseEntity );
  20. public:
  21. CTeam( void );
  22. virtual ~CTeam( void );
  23. DECLARE_SERVERCLASS();
  24. virtual void Precache( void ) { return; };
  25. virtual void Think( void );
  26. virtual int UpdateTransmitState( void );
  27. //-----------------------------------------------------------------------------
  28. // Initialization
  29. //-----------------------------------------------------------------------------
  30. virtual void Init( const char *pName, int iNumber );
  31. //-----------------------------------------------------------------------------
  32. // Data Handling
  33. //-----------------------------------------------------------------------------
  34. virtual int GetTeamNumber( void ) const;
  35. virtual void SetName( const char *pName );
  36. virtual const char *GetName( void );
  37. virtual void UpdateClientData( CBasePlayer *pPlayer );
  38. virtual int ShouldTransmitToPlayer( CBasePlayer* pRecipient, CBaseEntity* pEntity );
  39. virtual void SetClanName( const char *pName );
  40. virtual const char *GetClanName( void );
  41. virtual void SetClanID( uint32 iClanID );
  42. virtual uint32 GetClanID( void );
  43. virtual void SetFlagImageString( const char *pName );
  44. virtual const char *GetFlagImageString( void );
  45. virtual void SetLogoImageString( const char *pName );
  46. virtual const char *GetLogoImageString( void );
  47. virtual void SetNumMapVictories( int numVictories );
  48. //-----------------------------------------------------------------------------
  49. // Spawnpoints
  50. //-----------------------------------------------------------------------------
  51. virtual void InitializeSpawnpoints( void );
  52. virtual void AddSpawnpoint( CTeamSpawnPoint *pSpawnpoint );
  53. virtual void RemoveSpawnpoint( CTeamSpawnPoint *pSpawnpoint );
  54. virtual CBaseEntity *SpawnPlayer( CBasePlayer *pPlayer );
  55. //-----------------------------------------------------------------------------
  56. // Players
  57. //-----------------------------------------------------------------------------
  58. virtual void InitializePlayers( void );
  59. virtual void AddPlayer( CBasePlayer *pPlayer );
  60. virtual void RemovePlayer( CBasePlayer *pPlayer );
  61. virtual int GetNumPlayers( void );
  62. virtual CBasePlayer *GetPlayer( int iIndex );
  63. static int TeamGGSortFunction( CCSPlayer* const *entry1, CCSPlayer* const *entry2 );
  64. virtual void DetermineGGLeaderAndSort( void );
  65. virtual int GetGGLeader( int nTeam );
  66. //-----------------------------------------------------------------------------
  67. // Scoring
  68. //-----------------------------------------------------------------------------
  69. virtual void AddScore( int score ) { m_scoreTotal += score; }
  70. virtual void AddScoreFirstHalf( int score ) { m_scoreFirstHalf += score; }
  71. virtual void AddScoreSecondHalf( int score ) { m_scoreSecondHalf += score; }
  72. virtual void AddScoreOvertime( int score ) { m_scoreOvertime += score; }
  73. virtual void SetScore( int score ) { m_scoreTotal = score; }
  74. virtual void SetScoreFirstHalf( int score ) { m_scoreFirstHalf = score; }
  75. virtual void SetScoreSecondHalf( int score ) { m_scoreSecondHalf = score; }
  76. virtual void SetScoreOvertime( int score ) { m_scoreOvertime = score; }
  77. virtual int GetScore( void ) { return m_scoreTotal; }
  78. virtual int GetScoreFirstHalf( void ) { return m_scoreFirstHalf; }
  79. virtual int GetScoreSecondHalf( void ) { return m_scoreSecondHalf; }
  80. virtual int GetScoreOvertime( void ) { return m_scoreOvertime; }
  81. virtual void ResetScores( void );
  82. virtual void ResetTeamLeaders( void );
  83. void MarkSurrendered() { m_bSurrendered = 1; }
  84. void AwardAchievement( int iAchievement );
  85. virtual int GetAliveMembers( void );
  86. #if defined ( CSTRIKE15 )
  87. virtual int GetBotMembers( CUtlVector< class CCSBot* > *pOutVecBots = NULL );
  88. virtual int GetHumanMembers( CUtlVector< class CCSPlayer* > *pOutVecPlayers = NULL );
  89. #endif
  90. float m_flLastPlayerSortTime;
  91. static int m_nStaticGGLeader_CT;
  92. static int m_nStaticGGLeader_T;
  93. int m_nLastGGLeader_CT;
  94. int m_nLastGGLeader_T;
  95. public:
  96. CUtlVector< CTeamSpawnPoint * > m_aSpawnPoints;
  97. CUtlVector< CBasePlayer * > m_aPlayers;
  98. // Data
  99. CNetworkString( m_szTeamname, MAX_TEAM_NAME_LENGTH );
  100. CNetworkString( m_szClanTeamname, MAX_TEAM_NAME_LENGTH );
  101. CNetworkString( m_szTeamFlagImage, MAX_TEAM_FLAG_ICON_LENGTH );
  102. CNetworkString( m_szTeamLogoImage, MAX_TEAM_LOGO_ICON_LENGTH );
  103. CNetworkString( m_szTeamMatchStat, MAX_PATH );
  104. CNetworkVar( int, m_numMapVictories );
  105. CNetworkVar( uint32, m_iClanID );
  106. CNetworkVar( int, m_bSurrendered );
  107. CNetworkVar( int, m_scoreTotal );
  108. CNetworkVar( int, m_scoreFirstHalf );
  109. CNetworkVar( int, m_scoreSecondHalf );
  110. CNetworkVar( int, m_scoreOvertime );
  111. int m_iDeaths;
  112. CNetworkVar( int, m_nGGLeaderEntIndex_CT );
  113. CNetworkVar( int, m_nGGLeaderEntIndex_T );
  114. bool m_bGGHasLeader_CT;
  115. bool m_bGGHasLeader_T;
  116. // Spawnpoints
  117. int m_iLastSpawn; // Index of the last spawnpoint used
  118. CNetworkVar( int, m_iTeamNum ); // Which team is this?
  119. };
  120. extern CUtlVector< CTeam * > g_Teams;
  121. extern CTeam *GetGlobalTeam( int iIndex );
  122. extern int GetNumberOfTeams( void );
  123. extern const char* GetTeamName( int iTeam );
  124. #endif // TEAM_H