BASE.H 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. ** Command & Conquer(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: F:\projects\c&c\vcs\code\base.h_v 1.12 16 Oct 1995 16:46:38 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 COORD to build it at.
  39. */
  40. class BaseNodeClass
  41. {
  42. public:
  43. BaseNodeClass(void) {};
  44. int operator == (BaseNodeClass const & node);
  45. int operator != (BaseNodeClass const & node);
  46. int operator > (BaseNodeClass const & node);
  47. StructType Type;
  48. COORDINATE Coord;
  49. };
  50. /****************************************************************************
  51. ** This is the class that defines a pre-built base for the computer AI.
  52. ** (Despite its name, this is NOT the "base" class for C&C's class hierarchy!)
  53. */
  54. class BaseClass
  55. {
  56. public:
  57. /**********************************************************************
  58. ** Constructor/Destructor
  59. */
  60. BaseClass(void) {};
  61. virtual ~BaseClass() {Nodes.Clear();}
  62. /**********************************************************************
  63. ** Initialization
  64. */
  65. void Init(void) {Nodes.Clear();}
  66. /**********************************************************************
  67. ** The standard suite of load/save support routines
  68. */
  69. void Read_INI(char *buffer);
  70. void Write_INI(char *buffer);
  71. static char *INI_Name(void) {return "Base";}
  72. bool Load(FileClass & file);
  73. bool Save(FileClass & file);
  74. virtual void Code_Pointers(void) {};
  75. virtual void Decode_Pointers(void) {};
  76. /**********************************************************************
  77. ** Tells if the given node has been built or not
  78. */
  79. bool Is_Built(int index);
  80. /**********************************************************************
  81. ** Returns a pointer to the object for the given node
  82. */
  83. BuildingClass * Get_Building(int index);
  84. /**********************************************************************
  85. ** Tells if the given building ptr is a node in this base's list.
  86. */
  87. bool Is_Node (BuildingClass *obj);
  88. /**********************************************************************
  89. ** Returns a pointer to the requested node.
  90. */
  91. BaseNodeClass * Get_Node(BuildingClass *obj);
  92. BaseNodeClass * Get_Node(int index) { return (&Nodes[index]); }
  93. /**********************************************************************
  94. ** Returns a pointer to the next "hole" in the Nodes list.
  95. */
  96. BaseNodeClass * Next_Buildable(StructType type = STRUCT_NONE);
  97. /**********************************************************************
  98. ** This is the list of "nodes" that define the base. Portions of this
  99. ** list can be pre-built by simply saving those buildings in the INI
  100. ** along with non-base buildings, so Is_Built will return true for them.
  101. */
  102. DynamicVectorClass<BaseNodeClass> Nodes;
  103. /**********************************************************************
  104. ** This is the house this base belongs to.
  105. */
  106. HousesType House;
  107. };
  108. #endif