BASE.H 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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/BASE.H 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 : BASE.H *
  22. * *
  23. * Programmer : Bill Randolph *
  24. * *
  25. * Start Date : 03/27/95 *
  26. * *
  27. * Last Update : March 27, 1995 *
  28. * *
  29. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  30. #ifndef BASE_H
  31. #define BASE_H
  32. /****************************************************************************
  33. ** This class defines one "node" in the pre-built base list. Each node
  34. ** contains a type of building to build, and the COORDINATE to build it at.
  35. */
  36. class BaseNodeClass
  37. {
  38. public:
  39. BaseNodeClass(void) {};
  40. BaseNodeClass(StructType building, CELL cell) : Type(building), Cell(cell) {};
  41. int operator == (BaseNodeClass const & node);
  42. int operator != (BaseNodeClass const & node);
  43. int operator > (BaseNodeClass const & node);
  44. StructType Type;
  45. CELL Cell;
  46. };
  47. /****************************************************************************
  48. ** This is the class that defines a pre-built base for the computer AI.
  49. ** (Despite its name, this is NOT the "base" class for C&C's class hierarchy!)
  50. */
  51. class BaseClass
  52. {
  53. public:
  54. /*
  55. ** Constructor/Destructor
  56. */
  57. BaseClass(void) {};
  58. virtual ~BaseClass() {Nodes.Clear();}
  59. /*
  60. ** Initialization
  61. */
  62. void Init(void) {House = HOUSE_NONE; Nodes.Clear();}
  63. /*
  64. ** The standard suite of load/save support routines
  65. */
  66. void Read_INI(CCINIClass & ini);
  67. void Write_INI(CCINIClass & ini);
  68. static char *INI_Name(void) {return "Base";}
  69. bool Load(Straw & file);
  70. bool Save(Pipe & file) const;
  71. virtual void Code_Pointers(void) {};
  72. virtual void Decode_Pointers(void) {};
  73. /*
  74. ** Tells if the given node has been built or not
  75. */
  76. bool Is_Built(int index) const;
  77. /*
  78. ** Returns a pointer to the object for the given node
  79. */
  80. BuildingClass * Get_Building(int index) const;
  81. /*
  82. ** Tells if the given building ptr is a node in this base's list.
  83. */
  84. bool Is_Node(BuildingClass const * obj);
  85. /*
  86. ** Returns a pointer to the requested node.
  87. */
  88. BaseNodeClass * Get_Node(BuildingClass const * obj);
  89. BaseNodeClass * Get_Node(int index) { return (&Nodes[index]); }
  90. BaseNodeClass * Get_Node(CELL cell);
  91. /*
  92. ** Returns a pointer to the next "hole" in the Nodes list.
  93. */
  94. BaseNodeClass * Next_Buildable(StructType type = STRUCT_NONE);
  95. /*
  96. ** This is the list of "nodes" that define the base. Portions of this
  97. ** list can be pre-built by simply saving those buildings in the INI
  98. ** along with non-base buildings, so Is_Built will return true for them.
  99. */
  100. DynamicVectorClass<BaseNodeClass> Nodes;
  101. /*
  102. ** This is the house this base belongs to.
  103. */
  104. HousesType House;
  105. };
  106. #endif