CnC_Remastered_Collection

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

TEMPLATE.H (4815B)


      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\template.h_v   2.18   16 Oct 1995 16:45:20   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 : TEMPLATE.H                                                   *
     24  *                                                                                             *
     25  *                   Programmer : Joe L. Bostic                                                *
     26  *                                                                                             *
     27  *                   Start Date : May 17, 1994                                                 *
     28  *                                                                                             *
     29  *                  Last Update : May 17, 1994   [JLB]                                         *
     30  *                                                                                             *
     31  *---------------------------------------------------------------------------------------------*
     32  * Functions:                                                                                  *
     33  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     34 
     35 #ifndef TEMPLATE_H
     36 #define TEMPLATE_H
     37 
     38 #include	"object.h"
     39 #include	"type.h"
     40 
     41 /******************************************************************************
     42 **	This class controls the template object. Template objects function congruously
     43 **	to carpet on a floor. They have no depth, but merely control the icon to be rendered
     44 **	as the cell's bottom most layer.
     45 */
     46 class TemplateClass : public ObjectClass
     47 {
     48 	public:
     49 		/*-------------------------------------------------------------------
     50 		**	Constructors and destructors.
     51 		*/
     52 		static void * operator new(size_t size);
     53 		static void operator delete(void *ptr);
     54 		TemplateClass(void);
     55 		TemplateClass(TemplateType type, CELL pos=-1);
     56 		virtual ~TemplateClass(void) {if (GameActive) TemplateClass::Limbo();};
     57 		operator TemplateType(void) const {return Class->Type;};
     58 		virtual RTTIType What_Am_I(void) const {return RTTI_TEMPLATE;};
     59 
     60 		static void Init(void);
     61 
     62 		/*
     63 		**	Query functions.
     64 		*/
     65 		virtual ObjectTypeClass const & Class_Of(void) const {return *Class;};
     66 		int Icon_Number(CELL cell);
     67 
     68 		/*
     69 		**	Object entry and exit from the game system.
     70 		*/
     71 
     72 		/*
     73 		**	Display and rendering support functionality. Supports imagery and how
     74 		**	object interacts with the map and thus indirectly controls rendering.
     75 		*/
     76 		virtual void Draw_It(int , int , WindowNumberType ) {};
     77 		virtual bool Mark(MarkType mark);
     78 
     79 		/*
     80 		**	User I/O.
     81 		*/
     82 
     83 		/*
     84 		**	Combat related.
     85 		*/
     86 		virtual TARGET As_Target(void) const;
     87 
     88 		/*
     89 		**	File I/O.
     90 		*/
     91 		static void Read_INI(char *buffer);
     92 		static void Write_INI(char *buffer);
     93 		static char *INI_Name(void) {return "TEMPLATE";};
     94 		bool Load(FileClass & file);
     95 		bool Save(FileClass & file);
     96 		virtual void Code_Pointers(void);
     97 		virtual void Decode_Pointers(void);
     98 
     99 		/*
    100 		**	Dee-buggin' support.
    101 		*/
    102 		int Validate(void) const;
    103 
    104 	private:
    105 
    106 		/*
    107 		**	This is a pointer to the template object's class.
    108 		*/
    109 		TemplateTypeClass const * const Class;
    110 
    111 		/*
    112 		** Some additional padding in case we need to add data to the class and maintain backwards compatibility for save/load
    113 		*/
    114 		unsigned char SaveLoadPadding[8];
    115 
    116 		/*
    117 		** This contains the value of the Virtual Function Table Pointer
    118 		*/
    119 		static void * VTable;
    120 };
    121 
    122 #endif