CnC_Remastered_Collection

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

TEMPLATE.H (4301B)


      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/TEMPLATE.H 1     3/03/97 10:25a 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 /******************************************************************************
     43 **	This class controls the template object. Template objects function congruously
     44 **	to carpet on a floor. They have no depth, but merely control the icon to be rendered
     45 **	as the cell's bottom most layer.
     46 */
     47 class TemplateClass : public ObjectClass
     48 {
     49 	public:
     50 		/*
     51 		**	This is a pointer to the template object's class.
     52 		*/
     53 		CCPtr<TemplateTypeClass> Class;
     54 
     55 		/*-------------------------------------------------------------------
     56 		**	Constructors and destructors.
     57 		*/
     58 		static void * operator new(size_t size);
     59 		static void * operator new(size_t , void * ptr) {return(ptr);};
     60 		static void operator delete(void *ptr);
     61 		TemplateClass(TemplateType type, CELL pos=-1);
     62 		TemplateClass(NoInitClass const & x) : ObjectClass(x), Class(x) {};
     63 		virtual ~TemplateClass(void) {if (GameActive) TemplateClass::Limbo();Class=0;};
     64 		operator TemplateType(void) const {return Class->Type;};
     65 
     66 		static void Init(void);
     67 
     68 		/*
     69 		**	Query functions.
     70 		*/
     71 		virtual ObjectTypeClass const & Class_Of(void) const {return *Class;};
     72 		int Icon_Number(CELL cell);
     73 
     74 		/*
     75 		**	Display and rendering support functionality. Supports imagery and how
     76 		**	object interacts with the map and thus indirectly controls rendering.
     77 		*/
     78 		virtual void Draw_It(int , int , WindowNumberType ) const {};
     79 		virtual bool Mark(MarkType mark);
     80 
     81 		/*
     82 		**	File I/O.
     83 		*/
     84 		bool Load(Straw & file);
     85 		bool Save(Pipe & file) const;
     86 
     87 		/*
     88 		** Some additional padding in case we need to add data to the class and maintain backwards compatibility for save/load
     89 		*/
     90 		unsigned char SaveLoadPadding[8];
     91 };
     92 
     93 #endif