CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

TEAMTYPE.H (7675B)


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