GroupMgr.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. /*
  2. ** Command & Conquer Renegade(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. ///////////////////////////////////////////////////////////////////////////////////////
  19. //
  20. // GroupMgrClass.H
  21. //
  22. // Class declarations for managing different types of level items.
  23. //
  24. #ifndef __GROUPMGR_H
  25. #define __GROUPMGR_H
  26. #include "utils.h"
  27. #include "vector3.h"
  28. #include "aabox.h"
  29. #include "sphere.h"
  30. #include "uniquelist.h"
  31. #include "listtypes.h"
  32. class NodeClass;
  33. class PresetClass;
  34. ///////////////////////////////////////////////////////////////
  35. //
  36. // GroupMgrClass
  37. //
  38. // Used to manage all items in a group.
  39. //
  40. class GroupMgrClass
  41. {
  42. public:
  43. ///////////////////////////////////////////////////
  44. //
  45. // Public constructors/destructors
  46. //
  47. GroupMgrClass (void)
  48. : m_bHidden (false),
  49. m_bDirty (true) {}
  50. GroupMgrClass (const GroupMgrClass &src)
  51. : m_bHidden (false),
  52. m_bDirty (true) { *this = src; }
  53. virtual ~GroupMgrClass (void) { Free_List (); }
  54. ///////////////////////////////////////////////////
  55. //
  56. // Public methods
  57. //
  58. //
  59. // operators
  60. //
  61. NodeClass * operator[] (int index) { return m_GroupList[index]; }
  62. const NodeClass * operator[] (int index) const { return m_GroupList[index]; }
  63. const GroupMgrClass &operator= (const GroupMgrClass &src);
  64. //
  65. // Required enumeration methods
  66. //
  67. virtual int Get_Count (void) const { return m_GroupList.Count (); }
  68. virtual NodeClass * Get_At (int index) const { return m_GroupList[index]; }
  69. //
  70. // Item addition/removal methods
  71. //
  72. virtual void Add_Node (NodeClass *node);
  73. virtual void Import_Nodes (const NODE_LIST &node_list);
  74. virtual void Export_Nodes (NODE_LIST &node_list);
  75. virtual void Remove_Node (NodeClass *node);
  76. virtual void Reset (void);
  77. virtual void Free_List (void);
  78. virtual bool Is_Item_In_Group (NodeClass *node);
  79. //
  80. // Member information methods
  81. //
  82. virtual bool Is_Hidden (void) const { return m_bHidden; }
  83. virtual void Hide (bool bhide);
  84. //
  85. // Type methods
  86. //
  87. virtual bool Is_Managed (void) const { return true; }
  88. //
  89. // Information methods
  90. //
  91. const Vector3 & Get_Center (void) { Update (); return m_LowZCenter; }
  92. const Vector3 & Get_Abs_Center (void) { Update (); return m_AbsCenter; }
  93. const SphereClass & Get_Bounding_Sphere (void) { Update (); return m_BoundingSphere; }
  94. const AABoxClass & Get_Bounding_Box (void) { Update (); return m_BoundingBox; }
  95. const CString & Get_Name (void) const { return m_Name; }
  96. void Set_Name (LPCTSTR name) { m_Name = name; }
  97. //
  98. // Update methods
  99. //
  100. void Set_Dirty (void) { m_bDirty = true; }
  101. //
  102. // Copy methods
  103. //
  104. virtual void Clone_Group (void);
  105. protected:
  106. ///////////////////////////////////////////////////
  107. //
  108. // Protected member data
  109. //
  110. virtual void Recalc_Stats (void);
  111. virtual void Update (void) { if (m_bDirty) { Recalc_Stats (); } }
  112. ///////////////////////////////////////////////////
  113. //
  114. // Protected member data
  115. //
  116. NODE_LIST m_GroupList;
  117. SphereClass m_BoundingSphere;
  118. AABoxClass m_BoundingBox;
  119. Vector3 m_LowZCenter;
  120. Vector3 m_AbsCenter;
  121. CString m_Name;
  122. bool m_bDirty;
  123. bool m_bHidden;
  124. };
  125. ///////////////////////////////////////////////////////////////
  126. //
  127. // SelectionMgrClass
  128. //
  129. // Used to manage all items in the current selection set.
  130. //
  131. class SelectionMgrClass : public GroupMgrClass
  132. {
  133. public:
  134. ///////////////////////////////////////////////////
  135. //
  136. // Public constructors/destructors
  137. //
  138. SelectionMgrClass (void) : GroupMgrClass () {}
  139. virtual ~SelectionMgrClass (void) {}
  140. ///////////////////////////////////////////////////
  141. //
  142. // Public methods
  143. //
  144. //
  145. // Item addition/removal methods
  146. //
  147. virtual void Add_Node (NodeClass *node);
  148. virtual void Remove_Node (NodeClass *node);
  149. virtual void Reset (void);
  150. //
  151. // Copy methods
  152. //
  153. virtual void Clone_Group (void);
  154. };
  155. ///////////////////////////////////////////////////////////////
  156. //
  157. // UserGroupMgrClass
  158. //
  159. // Used to manage all nodes in a user-defined group .
  160. //
  161. class UserGroupMgrClass : public GroupMgrClass
  162. {
  163. public:
  164. ///////////////////////////////////////////////////
  165. //
  166. // Public constructors/destructors
  167. //
  168. UserGroupMgrClass (void) : GroupMgrClass () {}
  169. virtual ~UserGroupMgrClass (void);
  170. ///////////////////////////////////////////////////
  171. //
  172. // Public methods
  173. //
  174. //
  175. // Item addition/removal methods
  176. //
  177. virtual void Add_Node (NodeClass *node);
  178. virtual void Remove_Node (NodeClass *node);
  179. //
  180. // Type methods
  181. //
  182. virtual bool Is_Managed (void) const { return false; }
  183. protected:
  184. ///////////////////////////////////////////////////
  185. //
  186. // Protected methods
  187. //
  188. virtual void Recalc_Stats (void);
  189. virtual void Update_Global_Group_List (void);
  190. };
  191. #endif //__GROUPMGR_H