team.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** Confidential - Westwood Studios ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Commando *
  23. * *
  24. * $Archive:: /Commando/Code/Commando/team.h $*
  25. * *
  26. * $Author:: Tom_s $*
  27. * *
  28. * $Modtime:: 11/13/01 7:54p $*
  29. * *
  30. * $Revision:: 35 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSV_VER)
  36. #pragma once
  37. #endif
  38. #ifndef TEAM_H
  39. #define TEAM_H
  40. #include "vector3.h"
  41. #include "bittype.h"
  42. #include "soldier.h"
  43. #include "widestring.h"
  44. const int MAX_TEAMNAME_SIZE = 10; //including NULL
  45. class cPacket;
  46. //------------------------------------------------------------------------------------
  47. //
  48. // Holds data about a team
  49. //
  50. class cTeam : public NetworkObjectClass {
  51. public:
  52. friend class cTeamManager; // so that only cTeamManager can call ~cTeam
  53. cTeam(void);
  54. virtual uint32 Get_Network_Class_ID(void) const {return NETCLASSID_TEAM;}
  55. virtual void Delete(void) {delete this;}
  56. //
  57. // Server only
  58. //
  59. void Increment_Kills(void);
  60. void Increment_Deaths(void);
  61. void Increment_Score(float increment);
  62. //void Increment_Money(int increment);
  63. //
  64. // Client only
  65. //
  66. void Set_Kills(int new_kills);
  67. void Set_Deaths(int new_deaths);
  68. void Set_Score(float new_score);
  69. //void Set_Money(int new_money);
  70. //
  71. // Client or server
  72. //
  73. void Init(int team_number);
  74. void Init_Team_Name(void);
  75. WideStringClass Get_Name(void) const {return Name;}
  76. int Get_Id(void) const {return TeamNumber;}
  77. void Reset(void);
  78. int Tally_Size(void) const;
  79. int Get_Kills(void) const {return Kills;}
  80. int Get_Deaths(void) const {return Deaths;}
  81. float Get_Score(void) const {return Score;}
  82. //int Get_Money(void) const {return Money;}
  83. float Get_Kill_To_Death_Ratio(void) const;
  84. void Get_Team_String(int rank, WideStringClass & string) const;
  85. Vector3 Get_Color(void) const;
  86. int Tally_Money(void) const;
  87. //
  88. // Server-to-client data importing/exporting
  89. //
  90. virtual void Import_Creation(BitStreamClass &packet);
  91. virtual void Import_Rare(BitStreamClass &packet);
  92. virtual void Import_Occasional(BitStreamClass &packet);
  93. virtual void Import_Frequent(BitStreamClass &packet);
  94. virtual void Export_Creation(BitStreamClass &packet);
  95. virtual void Export_Rare(BitStreamClass &packet);
  96. virtual void Export_Occasional(BitStreamClass &packet);
  97. virtual void Export_Frequent(BitStreamClass &packet);
  98. private:
  99. ~cTeam(void); // only the cTeamManager can destroy...
  100. WideStringClass Name;
  101. int Kills;
  102. int Deaths;
  103. float Score;
  104. int Money;
  105. int TeamNumber;
  106. };
  107. #endif // TEAM_H