@@ -882,7 +882,7 @@ class AICommandInterface
882
882
* An "AIGroup" is a simple collection of AI objects, used by the AI
883
883
* for such things as Group Pathfinding.
884
884
*/
885
- class AIGroup : public MemoryPoolObject , public Snapshot , public RefCountClass
885
+ class AIGroup : public MemoryPoolObject , public Snapshot
886
886
{
887
887
private:
888
888
void groupAttackObjectPrivate ( Bool forced, Object *victim, Int maxShotsToFire, CommandSourceType cmdSource ); // /< attack given object
@@ -894,6 +894,10 @@ class AIGroup : public MemoryPoolObject, public Snapshot, public RefCountClass
894
894
void xfer ( Xfer *xfer );
895
895
void loadPostProcess ( void );
896
896
897
+ void Add_Ref () const { m_refCount.Add_Ref (); }
898
+ void Release_Ref () const { m_refCount.Release_Ref (destroy, this ); }
899
+ void Num_Refs () const { m_refCount.Num_Refs (); }
900
+
897
901
void groupMoveToPosition ( const Coord3D *pos, Bool addWaypoint, CommandSourceType cmdSource );
898
902
void groupMoveToAndEvacuate ( const Coord3D *pos, CommandSourceType cmdSource ); // /< move to given position(s)
899
903
void groupMoveToAndEvacuateAndExit ( const Coord3D *pos, CommandSourceType cmdSource ); // /< move to given position & unload transport.
@@ -1005,11 +1009,6 @@ class AIGroup : public MemoryPoolObject, public Snapshot, public RefCountClass
1005
1009
void releaseWeaponLockForGroup (WeaponLockType lockType);// /< Clear each guys weapon choice
1006
1010
void setWeaponSetFlag ( WeaponSetType wst );
1007
1011
1008
- virtual void Delete_This (void )
1009
- {
1010
- TheAI->destroyGroup (this );
1011
- }
1012
-
1013
1012
protected:
1014
1013
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE ( AIGroup, " AIGroupPool" ); // /< @todo Set real numbers for mem alloc
1015
1014
@@ -1025,6 +1024,11 @@ class AIGroup : public MemoryPoolObject, public Snapshot, public RefCountClass
1025
1024
friend class AI ;
1026
1025
AIGroup ( void );
1027
1026
1027
+ static void destroy (AIGroup* self)
1028
+ {
1029
+ TheAI->destroyGroup (self);
1030
+ }
1031
+
1028
1032
void recompute ( void ); // /< recompute various group info, such as speed, leader, etc
1029
1033
1030
1034
ListObjectPtr m_memberList; // /< the list of member Objects
@@ -1033,6 +1037,8 @@ class AIGroup : public MemoryPoolObject, public Snapshot, public RefCountClass
1033
1037
Real m_speed; // /< maximum speed of group (slowest member)
1034
1038
Bool m_dirty; // /< "dirty bit" - if true then group speed, leader, needs recompute
1035
1039
1040
+ RefCountValue<UnsignedShort> m_refCount; // /< the reference counter
1041
+
1036
1042
UnsignedInt m_id; // /< the unique ID of this group
1037
1043
Path *m_groundPath; // /< Group ground path.
1038
1044
0 commit comments