Team Fortress 2 Source Code as on 22/4/2020
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.

87 lines
1.8 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Client side CTeam class
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef C_TEAM_H
  8. #define C_TEAM_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "shareddefs.h"
  13. #include "utlvector.h"
  14. #include "client_thinklist.h"
  15. class C_BasePlayer;
  16. class C_Team : public C_BaseEntity
  17. {
  18. DECLARE_CLASS( C_Team, C_BaseEntity );
  19. public:
  20. DECLARE_CLIENTCLASS();
  21. DECLARE_PREDICTABLE();
  22. C_Team();
  23. virtual ~C_Team();
  24. virtual void PreDataUpdate( DataUpdateType_t updateType );
  25. // Data Handling
  26. virtual char *Get_Name( void );
  27. virtual int Get_Score( void );
  28. virtual int Get_Deaths( void );
  29. virtual int Get_Ping( void );
  30. // Player Handling
  31. virtual int Get_Number_Players( void );
  32. virtual bool ContainsPlayer( int iPlayerIndex );
  33. C_BasePlayer* GetPlayer( int idx );
  34. // for shared code, use the same function name
  35. virtual int GetNumPlayers( void ) { return Get_Number_Players(); }
  36. int GetTeamNumber() const;
  37. int GetRoundsWon(void) { return m_iRoundsWon; }
  38. void RemoveAllPlayers();
  39. // IClientThinkable overrides.
  40. public:
  41. virtual void ClientThink();
  42. public:
  43. // Data received from the server
  44. CUtlVector< int > m_aPlayers;
  45. char m_szTeamname[ MAX_TEAM_NAME_LENGTH ];
  46. int m_iScore;
  47. int m_iRoundsWon;
  48. // Data for the scoreboard
  49. int m_iDeaths;
  50. int m_iPing;
  51. int m_iPacketloss;
  52. int m_iTeamNum;
  53. };
  54. // Global list of client side team entities
  55. extern CUtlVector< C_Team * > g_Teams;
  56. // Global team handling functions
  57. C_Team *GetLocalTeam( void );
  58. C_Team *GetGlobalTeam( int iTeamNumber );
  59. C_Team *GetPlayersTeam( int iPlayerIndex );
  60. C_Team *GetPlayersTeam( C_BasePlayer *pPlayer );
  61. bool ArePlayersOnSameTeam( int iPlayerIndex1, int iPlayerIndex2 );
  62. extern int GetNumberOfTeams( void );
  63. #endif // C_TEAM_H