CCPTR.CPP 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /* $Header: /CounterStrike/CCPTR.CPP 1 3/03/97 10:24a Joe_bostic $ */
  15. /***********************************************************************************************
  16. *** 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 ***
  17. ***********************************************************************************************
  18. * *
  19. * Project Name : Command & Conquer *
  20. * *
  21. * File Name : CCPTR.CPP *
  22. * *
  23. * Programmer : Joe L. Bostic *
  24. * *
  25. * Start Date : 06/07/96 *
  26. * *
  27. * Last Update : July 6, 1996 [JLB] *
  28. * *
  29. *---------------------------------------------------------------------------------------------*
  30. * Functions: *
  31. * CCPtr<T>::operator > -- Greater than comparison operator. *
  32. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  33. #include "function.h"
  34. template class CCPtr<AircraftClass>;
  35. template class CCPtr<AircraftTypeClass>;
  36. template class CCPtr<AnimClass>;
  37. template class CCPtr<AnimTypeClass>;
  38. template class CCPtr<BuildingClass>;
  39. template class CCPtr<BuildingTypeClass>;
  40. template class CCPtr<BulletClass>;
  41. template class CCPtr<BulletTypeClass>;
  42. template class CCPtr<FactoryClass>;
  43. template class CCPtr<HouseClass>;
  44. template class CCPtr<HouseTypeClass>;
  45. template class CCPtr<InfantryClass>;
  46. template class CCPtr<InfantryTypeClass>;
  47. template class CCPtr<OverlayClass>;
  48. template class CCPtr<OverlayTypeClass>;
  49. template class CCPtr<SmudgeClass>;
  50. template class CCPtr<SmudgeTypeClass>;
  51. template class CCPtr<TeamClass>;
  52. template class CCPtr<TeamTypeClass>;
  53. template class CCPtr<TemplateClass>;
  54. template class CCPtr<TemplateTypeClass>;
  55. template class CCPtr<TerrainClass>;
  56. template class CCPtr<TerrainTypeClass>;
  57. template class CCPtr<TriggerClass>;
  58. template class CCPtr<TriggerTypeClass>;
  59. template class CCPtr<UnitClass>;
  60. template class CCPtr<UnitTypeClass>;
  61. template class CCPtr<VesselClass>;
  62. template class CCPtr<VesselTypeClass>;
  63. template class CCPtr<WarheadTypeClass>;
  64. template class CCPtr<WeaponTypeClass>;
  65. template<class T> FixedIHeapClass* CCPtr<T>::Heap = NULL;
  66. /*
  67. ** These member functions for the CCPtr class cannot be declared inside the
  68. ** class definition since they could refer to other objects that themselves
  69. ** contain CCPtr objects. The recursive nature of this type of declaration
  70. ** is not handled by Watcom, hence the body declaration is dislocated here.
  71. */
  72. template<class T>
  73. CCPtr<T>::CCPtr(T * ptr) : ID(-1)
  74. {
  75. if (ptr != NULL) {
  76. ID = ptr->ID;
  77. }
  78. }
  79. /***********************************************************************************************
  80. * CCPtr<T>::operator > -- Greater than comparison operator. *
  81. * *
  82. * This will compare two pointer value to see if the left hand value is greater than the *
  83. * right hand. The values are compared by comparing based on their Name() functions. *
  84. * *
  85. * INPUT: rvalue -- The right handle CCPtr value. *
  86. * *
  87. * OUTPUT: Is the left hand value greater than the right hand value? *
  88. * *
  89. * WARNINGS: The values pointed to by CCPtr must have a Name() function defined. *
  90. * *
  91. * HISTORY: *
  92. * 07/06/1996 JLB : Created. *
  93. *=============================================================================================*/
  94. template<class T>
  95. bool CCPtr<T>::operator > (CCPtr<T> const & rvalue) const
  96. {
  97. return (stricmp((*this)->Name(), rvalue->Name()) > 0);
  98. }