TEAMTYPE.H 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. /*
  2. ** Command & Conquer(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. /* $Header: F:\projects\c&c\vcs\code\teamtype.h_v 2.18 16 Oct 1995 16:45:40 JOE_BOSTIC $ */
  19. /***************************************************************************
  20. ** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
  21. ***************************************************************************
  22. * *
  23. * Project Name : Command & Conquer *
  24. * *
  25. * File Name : TEAMTYPE.H *
  26. * *
  27. * Programmer : Bill Randolph *
  28. * *
  29. * Start Date : December 7, 1994 *
  30. * *
  31. * Last Update : December 7, 1994 [BR] *
  32. * *
  33. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  34. #ifndef TEAMTYPE_H
  35. #define TEAMTYPE_H
  36. /*
  37. ********************************** Defines **********************************
  38. */
  39. //#define TEAMTYPE_MAX 20 // max # of different team types
  40. /*
  41. ** TeamMissionType: the various missions that a team can have.
  42. */
  43. typedef enum TeamMissionType {
  44. TMISSION_NONE=-1,
  45. TMISSION_ATTACKBASE, // Attack nearest enemy base.
  46. TMISSION_ATTACKUNITS, // Attack all enemy units.
  47. TMISSION_ATTACKCIVILIANS, // Attack all civilians
  48. TMISSION_RAMPAGE, // attack & destroy anything that's not mine
  49. TMISSION_DEFENDBASE, // Protect my base.
  50. // TMISSION_HARVEST, // stake out a Tiberium claim, defend & harvest it
  51. TMISSION_MOVE, // moves to waypoint specified.
  52. TMISSION_MOVECELL, // moves to cell # specified.
  53. TMISSION_RETREAT, // order given by superior team, for coordinating
  54. TMISSION_GUARD, // works like an infantry's guard mission
  55. TMISSION_LOOP, // loop back to start of mission list
  56. TMISSION_ATTACKTARCOM, // attack tarcom
  57. TMISSION_UNLOAD, // Unload at current location.
  58. TMISSION_COUNT,
  59. TMISSION_FIRST=0
  60. } TeamMissionType;
  61. /*
  62. ** Forward declarations.
  63. */
  64. class TechnoTypeClass;
  65. /*
  66. ** This structure contains one team mission value & its argument.
  67. */
  68. typedef struct TeamMissionTag
  69. {
  70. TeamMissionType Mission;
  71. int Argument;
  72. } TeamMissionStruct;
  73. /*
  74. ** TeamTypeClass declaration
  75. */
  76. class TeamTypeClass : public AbstractTypeClass
  77. {
  78. public:
  79. enum TeamTypeClassEnums {
  80. MAX_TEAM_CLASSCOUNT=5,
  81. MAX_TEAM_MISSIONS=20
  82. };
  83. /*
  84. ** Constructor/Destructor
  85. */
  86. TeamTypeClass(void);
  87. virtual ~TeamTypeClass(void) {};
  88. /*
  89. ** Initialization: clears all team types in preparation for new scenario
  90. */
  91. static void Init(void);
  92. /*
  93. ** File I/O routines
  94. */
  95. static void Read_INI(char *buffer);
  96. void Fill_In(char *name, char *entry);
  97. static void Write_INI(char *buffer, bool refresh);
  98. static void Read_Old_INI(char *buffer);
  99. static char * INI_Name(void) {return "TeamTypes";};
  100. bool Load(FileClass & file);
  101. bool Save(FileClass & file);
  102. void Code_Pointers(void);
  103. void Decode_Pointers(void);
  104. /*
  105. ** As_Pointer gets a pointer to the trigger object give its name
  106. */
  107. static TeamTypeClass *As_Pointer(char *name);
  108. /*
  109. ** Processing routines
  110. */
  111. void Remove(void);
  112. TeamClass * Create_One_Of(void) const;
  113. void Destroy_All_Of(void) const;
  114. /*
  115. ** Utility routines
  116. */
  117. static char const * Name_From_Mission(TeamMissionType order);
  118. static TeamMissionType Mission_From_Name(char const *name);
  119. static TeamTypeClass const * Suggested_New_Team(HouseClass * house, long utypes, long itypes, bool alerted);
  120. TARGET As_Target(void) const;
  121. /*
  122. ** Overloaded operators
  123. */
  124. void * operator new(size_t );
  125. void operator delete(void *ptr);
  126. /*
  127. ** Dee-buggin' support.
  128. */
  129. int Validate(void) const;
  130. /*
  131. ** If this teamtype object is active, then this flag will be true.
  132. ** TeamType objects that are not active are either not yet created or have
  133. ** been deleted after fulfilling their action.
  134. */
  135. unsigned IsActive:1;
  136. /*
  137. ** If RoundAbout, the team avoids high-threat areas
  138. */
  139. unsigned IsRoundAbout:1;
  140. /*
  141. ** If Learning, the team learns from mistakes
  142. */
  143. unsigned IsLearning:1;
  144. /*
  145. ** If Suicide, the team won't stop until it achieves its mission or it's
  146. ** dead
  147. */
  148. unsigned IsSuicide:1;
  149. /*
  150. ** Is this team type allowed to be created automatically by the computer
  151. ** when the appropriate trigger indicates?
  152. */
  153. unsigned IsAutocreate:1;
  154. /*
  155. ** Mercenaries will change sides if they start to lose.
  156. */
  157. unsigned IsMercenary:1;
  158. /*
  159. ** This flag tells the computer that it should build members to fill
  160. ** a team of this type regardless of whether there actually is a team
  161. ** of this type active.
  162. */
  163. unsigned IsPrebuilt:1;
  164. /*
  165. ** If this team should allow recruitment of new members, then this flag
  166. ** will be true. A false value results in a team that fights until it
  167. ** is dead. This is similar to IsSuicide, but they will defend themselves.
  168. */
  169. unsigned IsReinforcable:1;
  170. /*
  171. ** A transient team type was created exclusively to bring on reinforcements
  172. ** as a result of some special event. As soon as there are no teams
  173. ** existing of this type, then this team type should be deleted.
  174. */
  175. unsigned IsTransient:1;
  176. /*
  177. ** Priority given the team for recruiting purposes; higher priority means
  178. ** it can steal members from other teams (scale: 0 - 15)
  179. */
  180. int RecruitPriority;
  181. /*
  182. ** Initial # of this type of team
  183. */
  184. unsigned char InitNum;
  185. /*
  186. ** Max # of this type of team allowed at one time
  187. */
  188. unsigned char MaxAllowed;
  189. /*
  190. ** Fear level of this team
  191. */
  192. unsigned char Fear;
  193. /*
  194. ** House the team belongs to
  195. */
  196. HousesType House;
  197. /*
  198. ** The mission list for this team
  199. */
  200. int MissionCount;
  201. TeamMissionStruct MissionList[MAX_TEAM_MISSIONS];
  202. /*
  203. ** Number of different classes in the team
  204. */
  205. unsigned char ClassCount;
  206. /*
  207. ** Array of object types comprising the team
  208. */
  209. TechnoTypeClass const * Class[MAX_TEAM_CLASSCOUNT];
  210. /*
  211. ** Desired # of each type of object comprising the team
  212. */
  213. unsigned char DesiredNum[MAX_TEAM_CLASSCOUNT];
  214. private:
  215. static char const * TMissions[TMISSION_COUNT];
  216. /*
  217. ** This contains the value of the Virtual Function Table Pointer
  218. */
  219. static void * VTable;
  220. };
  221. #endif