CnC_Remastered_Collection

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

BASE.H (4711B)


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