Skip to content

Commit 069978a

Browse files
committed
Replace RefCountClass with RefCountValue to avoid changing size of class AIGroup
1 parent a1a1e8c commit 069978a

File tree

1 file changed

+12
-6
lines changed
  • GeneralsMD/Code/GameEngine/Include/GameLogic

1 file changed

+12
-6
lines changed

GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ class AICommandInterface
882882
* An "AIGroup" is a simple collection of AI objects, used by the AI
883883
* for such things as Group Pathfinding.
884884
*/
885-
class AIGroup : public MemoryPoolObject, public Snapshot, public RefCountClass
885+
class AIGroup : public MemoryPoolObject, public Snapshot
886886
{
887887
private:
888888
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
894894
void xfer( Xfer *xfer );
895895
void loadPostProcess( void );
896896

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+
897901
void groupMoveToPosition( const Coord3D *pos, Bool addWaypoint, CommandSourceType cmdSource );
898902
void groupMoveToAndEvacuate( const Coord3D *pos, CommandSourceType cmdSource ); ///< move to given position(s)
899903
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
10051009
void releaseWeaponLockForGroup(WeaponLockType lockType);///< Clear each guys weapon choice
10061010
void setWeaponSetFlag( WeaponSetType wst );
10071011

1008-
virtual void Delete_This(void)
1009-
{
1010-
TheAI->destroyGroup(this);
1011-
}
1012-
10131012
protected:
10141013
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( AIGroup, "AIGroupPool" ); ///< @todo Set real numbers for mem alloc
10151014

@@ -1025,6 +1024,11 @@ class AIGroup : public MemoryPoolObject, public Snapshot, public RefCountClass
10251024
friend class AI;
10261025
AIGroup( void );
10271026

1027+
static void destroy(AIGroup* self)
1028+
{
1029+
TheAI->destroyGroup(self);
1030+
}
1031+
10281032
void recompute( void ); ///< recompute various group info, such as speed, leader, etc
10291033

10301034
ListObjectPtr m_memberList; ///< the list of member Objects
@@ -1033,6 +1037,8 @@ class AIGroup : public MemoryPoolObject, public Snapshot, public RefCountClass
10331037
Real m_speed; ///< maximum speed of group (slowest member)
10341038
Bool m_dirty; ///< "dirty bit" - if true then group speed, leader, needs recompute
10351039

1040+
RefCountValue<UnsignedShort> m_refCount; ///< the reference counter
1041+
10361042
UnsignedInt m_id; ///< the unique ID of this group
10371043
Path *m_groundPath; ///< Group ground path.
10381044

0 commit comments

Comments
 (0)