Group.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. * FILE
  21. * Group.h
  22. *
  23. * DESCRIPTION
  24. * Group definitions
  25. *
  26. * PROGRAMMER
  27. * Denzil E. Long, Jr.
  28. *
  29. * VERSION INFO
  30. * $Author: Denzil_l $
  31. * $Revision: 1 $
  32. * $Modtime: 4/17/00 9:42a $
  33. * $Archive: /Commando/Code/Scripts/Group.h $
  34. *
  35. ******************************************************************************/
  36. #ifndef _GROUP_H_
  37. #define _GROUP_H_
  38. #include "scripts.h"
  39. #include "vector.h"
  40. // Group event identifiers
  41. typedef enum
  42. {
  43. GROUP_MEMBER_DAMAGED = 1,
  44. GROUP_MEMBER_KILLED,
  45. GROUP_MEMBER_HEARD,
  46. GROUP_MEMBER_SAW,
  47. } GroupEvent;
  48. // Group event information.
  49. //
  50. // A pointer to this structure is sent as a data parameter when the custom
  51. // event SCMD_GROUP_EVENT is sent to an object.
  52. typedef struct GroupEventInfoTag
  53. {
  54. const char* GroupName;
  55. GroupEvent Event;
  56. union
  57. {
  58. GameObject* Object;
  59. const CombatSound* Sound;
  60. };
  61. } GroupEventInfo;
  62. class GroupController;
  63. class Group
  64. {
  65. public:
  66. // Retrieve Team name
  67. const char* GetName(void) const;
  68. // Add a GameObject to the team.
  69. void AddMember(GameObject* object);
  70. // Remove a GameObject from the team.
  71. void RemoveMember(GameObject* object);
  72. // Check if a GameObject is a member of the team.
  73. bool IsMember(GameObject* object) const;
  74. // Get the number of members in the team.
  75. int MemberCount(void) const;
  76. // Get a team member.
  77. GameObject* GetMember(int index);
  78. // Send a command to all the members of the team.
  79. void SendCustomEvent(GameObject* from, int event, int data);
  80. protected:
  81. // Only the TeamController can create and delete Teams
  82. friend class GroupController;
  83. Group(const char* name);
  84. ~Group();
  85. private:
  86. char mName[64];
  87. DynamicVectorClass<GameObject*> mMembers;
  88. };
  89. #endif // _GROUP_H_