CnC_Remastered_Collection

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

CCPTR.CPP (5912B)


      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/CCPTR.CPP 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 : CCPTR.CPP                                                    *
     24  *                                                                                             *
     25  *                   Programmer : Joe L. Bostic                                                *
     26  *                                                                                             *
     27  *                   Start Date : 06/07/96                                                     *
     28  *                                                                                             *
     29  *                  Last Update : July 6, 1996 [JLB]                                           *
     30  *                                                                                             *
     31  *---------------------------------------------------------------------------------------------*
     32  * Functions:                                                                                  *
     33  *   CCPtr<T>::operator > -- Greater than comparison operator.                                 *
     34  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     35 
     36 
     37 #include	"function.h"
     38 
     39 
     40  
     41 template class CCPtr<AircraftClass>;
     42 template class CCPtr<AircraftTypeClass>;
     43 template class CCPtr<AnimClass>;
     44 template class CCPtr<AnimTypeClass>;
     45 template class CCPtr<BuildingClass>;
     46 template class CCPtr<BuildingTypeClass>;
     47 template class CCPtr<BulletClass>;
     48 template class CCPtr<BulletTypeClass>;
     49 template class CCPtr<FactoryClass>;
     50 template class CCPtr<HouseClass>;
     51 template class CCPtr<HouseTypeClass>;
     52 template class CCPtr<InfantryClass>;
     53 template class CCPtr<InfantryTypeClass>;
     54 template class CCPtr<OverlayClass>;
     55 template class CCPtr<OverlayTypeClass>;
     56 template class CCPtr<SmudgeClass>;
     57 template class CCPtr<SmudgeTypeClass>;
     58 template class CCPtr<TeamClass>;
     59 template class CCPtr<TeamTypeClass>;
     60 template class CCPtr<TemplateClass>;
     61 template class CCPtr<TemplateTypeClass>;
     62 template class CCPtr<TerrainClass>;
     63 template class CCPtr<TerrainTypeClass>;
     64 template class CCPtr<TriggerClass>;
     65 template class CCPtr<TriggerTypeClass>;
     66 template class CCPtr<UnitClass>;
     67 template class CCPtr<UnitTypeClass>;
     68 template class CCPtr<VesselClass>;
     69 template class CCPtr<VesselTypeClass>;
     70 template class CCPtr<WarheadTypeClass>;
     71 template class CCPtr<WeaponTypeClass>;
     72 
     73 
     74 template<class T> FixedIHeapClass* CCPtr<T>::Heap = NULL;
     75 
     76 
     77 /*
     78 **	These member functions for the CCPtr class cannot be declared inside the
     79 **	class definition since they could refer to other objects that themselves
     80 **	contain CCPtr objects. The recursive nature of this type of declaration
     81 **	is not handled by Watcom, hence the body declaration is dislocated here.
     82 */
     83 template<class T>
     84 CCPtr<T>::CCPtr(T * ptr) : ID(-1)
     85 {
     86 	if (ptr != NULL) {
     87 		ID = ptr->ID;
     88 	}
     89 }
     90 
     91 
     92 /***********************************************************************************************
     93  * CCPtr<T>::operator > -- Greater than comparison operator.                                   *
     94  *                                                                                             *
     95  *    This will compare two pointer value to see if the left hand value is greater than the    *
     96  *    right hand. The values are compared by comparing based on their Name() functions.        *
     97  *                                                                                             *
     98  * INPUT:   rvalue   -- The right handle CCPtr value.                                          *
     99  *                                                                                             *
    100  * OUTPUT:  Is the left hand value greater than the right hand value?                          *
    101  *                                                                                             *
    102  * WARNINGS:   The values pointed to by CCPtr must have a Name() function defined.             *
    103  *                                                                                             *
    104  * HISTORY:                                                                                    *
    105  *   07/06/1996 JLB : Created.                                                                 *
    106  *=============================================================================================*/
    107 template<class T>
    108 bool CCPtr<T>::operator > (CCPtr<T> const & rvalue) const
    109 {
    110 	return (stricmp((*this)->Name(), rvalue->Name()) > 0);
    111 }