BASE.H 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. ** Command & Conquer Red Alert(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /* $Header: /CounterStrike/BASE.H 1 3/03/97 10:24a Joe_bostic $ */
  19. /***********************************************************************************************
  20. *** 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 ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Command & Conquer *
  24. * *
  25. * File Name : BASE.H *
  26. * *
  27. * Programmer : Bill Randolph *
  28. * *
  29. * Start Date : 03/27/95 *
  30. * *
  31. * Last Update : March 27, 1995 *
  32. * *
  33. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  34. #ifndef BASE_H
  35. #define BASE_H
  36. /****************************************************************************
  37. ** This class defines one "node" in the pre-built base list. Each node
  38. ** contains a type of building to build, and the COORDINATE to build it at.
  39. */
  40. class BaseNodeClass
  41. {
  42. public:
  43. BaseNodeClass(void) {};
  44. BaseNodeClass(StructType building, CELL cell) : Type(building), Cell(cell) {};
  45. int operator == (BaseNodeClass const & node);
  46. int operator != (BaseNodeClass const & node);
  47. int operator > (BaseNodeClass const & node);
  48. StructType Type;
  49. CELL Cell;
  50. };
  51. /****************************************************************************
  52. ** This is the class that defines a pre-built base for the computer AI.
  53. ** (Despite its name, this is NOT the "base" class for C&C's class hierarchy!)
  54. */
  55. class BaseClass
  56. {
  57. public:
  58. /*
  59. ** Constructor/Destructor
  60. */
  61. BaseClass(void) {};
  62. virtual ~BaseClass() {Nodes.Clear();}
  63. /*
  64. ** Initialization
  65. */
  66. void Init(void) {House = HOUSE_NONE; Nodes.Clear();}
  67. /*
  68. ** The standard suite of load/save support routines
  69. */
  70. void Read_INI(CCINIClass & ini);
  71. void Write_INI(CCINIClass & ini);
  72. static char *INI_Name(void) {return "Base";}
  73. bool Load(Straw & file);
  74. bool Save(Pipe & file) const;
  75. virtual void Code_Pointers(void) {};
  76. virtual void Decode_Pointers(void) {};
  77. /*
  78. ** Tells if the given node has been built or not
  79. */
  80. bool Is_Built(int index) const;
  81. /*
  82. ** Returns a pointer to the object for the given node
  83. */
  84. BuildingClass * Get_Building(int index) const;
  85. /*
  86. ** Tells if the given building ptr is a node in this base's list.
  87. */
  88. bool Is_Node(BuildingClass const * obj);
  89. /*
  90. ** Returns a pointer to the requested node.
  91. */
  92. BaseNodeClass * Get_Node(BuildingClass const * obj);
  93. BaseNodeClass * Get_Node(int index) { return (&Nodes[index]); }
  94. BaseNodeClass * Get_Node(CELL cell);
  95. /*
  96. ** Returns a pointer to the next "hole" in the Nodes list.
  97. */
  98. BaseNodeClass * Next_Buildable(StructType type = STRUCT_NONE);
  99. /*
  100. ** This is the list of "nodes" that define the base. Portions of this
  101. ** list can be pre-built by simply saving those buildings in the INI
  102. ** along with non-base buildings, so Is_Built will return true for them.
  103. */
  104. DynamicVectorClass<BaseNodeClass> Nodes;
  105. /*
  106. ** This is the house this base belongs to.
  107. */
  108. HousesType House;
  109. };
  110. #endif