CnC_Remastered_Collection

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

BASE.H (5258B)


      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\base.h_v   1.12   16 Oct 1995 16:46:38   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 : BASE.H                                                       *
     24  *                                                                                             *
     25  *                   Programmer : Bill Randolph																  *
     26  *                                                                                             *
     27  *                   Start Date : 03/27/95                                                     *
     28  *                                                                                             *
     29  *                  Last Update : March 27, 1995															  *
     30  *                                                                                             *
     31  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     32 
     33 #ifndef BASE_H
     34 #define BASE_H
     35 
     36 
     37 /****************************************************************************
     38 ** This class defines one "node" in the pre-built base list.  Each node
     39 ** contains a type of building to build, and the COORD to build it at.
     40 */
     41 class BaseNodeClass
     42 {
     43 	public:
     44 		BaseNodeClass(void) {};
     45 		int operator == (BaseNodeClass const & node);
     46 		int operator != (BaseNodeClass const & node);
     47 		int operator > (BaseNodeClass const & node);
     48 
     49 		StructType Type;
     50 		COORDINATE Coord;
     51 };
     52 
     53 
     54 /****************************************************************************
     55 ** This is the class that defines a pre-built base for the computer AI.
     56 ** (Despite its name, this is NOT the "base" class for C&C's class hierarchy!)
     57 */
     58 class BaseClass
     59 {
     60 	public:
     61 
     62 		/**********************************************************************
     63 		** Constructor/Destructor
     64 		*/
     65 		BaseClass(void) {};
     66 		virtual ~BaseClass() {Nodes.Clear();}
     67 
     68 		/**********************************************************************
     69 		** Initialization
     70 		*/
     71 		void Init(void) {Nodes.Clear();}
     72 
     73 		/**********************************************************************
     74 		** The standard suite of load/save support routines
     75 		*/
     76 		void Read_INI(char *buffer);
     77 		void Write_INI(char *buffer);
     78 		static char *INI_Name(void) {return "Base";}
     79 		bool Load(FileClass & file);
     80 		bool Save(FileClass & file);
     81 		virtual void Code_Pointers(void) {};
     82 		virtual void Decode_Pointers(void) {};
     83 
     84 		/**********************************************************************
     85 		** Tells if the given node has been built or not
     86 		*/
     87 		bool Is_Built(int index);
     88 
     89 		/**********************************************************************
     90 		** Returns a pointer to the object for the given node
     91 		*/
     92 		BuildingClass * Get_Building(int index);
     93 
     94 		/**********************************************************************
     95 		** Tells if the given building ptr is a node in this base's list.
     96 		*/
     97 		bool Is_Node (BuildingClass *obj);
     98 
     99 		/**********************************************************************
    100 		** Returns a pointer to the requested node.
    101 		*/
    102 		BaseNodeClass * Get_Node(BuildingClass *obj);
    103 		BaseNodeClass * Get_Node(int index) { return (&Nodes[index]); }
    104 
    105 		/**********************************************************************
    106 		** Returns a pointer to the next "hole" in the Nodes list.
    107 		*/
    108 		BaseNodeClass * Next_Buildable(StructType type = STRUCT_NONE);
    109 
    110 		/**********************************************************************
    111 		** This is the list of "nodes" that define the base.  Portions of this
    112 		** list can be pre-built by simply saving those buildings in the INI
    113 		** along with non-base buildings, so Is_Built will return true for them.
    114 		*/
    115 		DynamicVectorClass<BaseNodeClass> Nodes;
    116 
    117 		/**********************************************************************
    118 		** This is the house this base belongs to.
    119 		*/
    120 		HousesType House;
    121 };
    122 
    123 
    124 #endif