diff options
| author | ccrs <ccrs@users.noreply.github.com> | 2025-10-25 16:17:49 +0200 |
|---|---|---|
| committer | ccrs <ccrs@users.noreply.github.com> | 2025-10-25 16:17:49 +0200 |
| commit | 825c88e85adbeb788ac903667632faeed99870e4 (patch) | |
| tree | 96eb0c25aac186985b9d836629666d9edd50eb8e /src | |
| parent | 243f859c1a2adfdb52ee0c28b35a231924131d09 (diff) | |
Core/Movement: implement MOTIONMASTER_FLAG_STATIC_PREVENT_INITIALIZATION in MotionMaster + allow public flag access
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Movement/MotionMaster.cpp | 5 | ||||
| -rw-r--r-- | src/server/game/Movement/MotionMaster.h | 9 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 4fdae221e41..b26d769da59 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -304,7 +304,10 @@ void MotionMaster::Update(uint32 diff) if (HasFlag(MOTIONMASTER_FLAG_STATIC_INITIALIZATION_PENDING) && IsStatic(top)) { RemoveFlag(MOTIONMASTER_FLAG_STATIC_INITIALIZATION_PENDING); - top->Initialize(_owner); + if (!HasFlag(MOTIONMASTER_FLAG_STATIC_PREVENT_INITIALIZATION)) + top->Initialize(_owner); + else + RemoveFlag(MOTIONMASTER_FLAG_STATIC_PREVENT_INITIALIZATION); } if (top->HasFlag(MOVEMENTGENERATOR_FLAG_INITIALIZATION_PENDING)) top->Initialize(_owner); diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index 6f4957c37a3..91aeadc6c03 100644 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -49,6 +49,7 @@ enum MotionMasterFlags : uint8 MOTIONMASTER_FLAG_STATIC_INITIALIZATION_PENDING = 0x2, // Static movement (MOTION_SLOT_DEFAULT) hasn't been initialized MOTIONMASTER_FLAG_INITIALIZATION_PENDING = 0x4, // MotionMaster is stalled until signaled MOTIONMASTER_FLAG_INITIALIZING = 0x8, // MotionMaster is initializing + MOTIONMASTER_FLAG_STATIC_PREVENT_INITIALIZATION = 0x10, MOTIONMASTER_FLAG_DELAYED = MOTIONMASTER_FLAG_UPDATE | MOTIONMASTER_FLAG_INITIALIZATION_PENDING }; @@ -194,14 +195,14 @@ class TC_GAME_API MotionMaster void MoveFormation(Unit* leader, float range, float angle, uint32 point1, uint32 point2); void LaunchMoveSpline(std::function<void(Movement::MoveSplineInit& init)>&& initializer, uint32 id = 0, MovementGeneratorPriority priority = MOTION_PRIORITY_NORMAL, MovementGeneratorType type = EFFECT_MOTION_TYPE); - private: - typedef std::unique_ptr<MovementGenerator, MovementGeneratorDeleter> MovementGeneratorPointer; - typedef std::multiset<MovementGenerator*, MovementGeneratorComparator> MotionMasterContainer; - typedef std::unordered_multimap<uint32, MovementGenerator const*> MotionMasterUnitStatesContainer; void AddFlag(uint8 const flag) { _flags |= flag; } bool HasFlag(uint8 const flag) const { return (_flags & flag) != 0; } void RemoveFlag(uint8 const flag) { _flags &= ~flag; } + private: + typedef std::unique_ptr<MovementGenerator, MovementGeneratorDeleter> MovementGeneratorPointer; + typedef std::multiset<MovementGenerator*, MovementGeneratorComparator> MotionMasterContainer; + typedef std::unordered_multimap<uint32, MovementGenerator const*> MotionMasterUnitStatesContainer; void ResolveDelayedActions(); void Remove(MotionMasterContainer::iterator iterator, bool active, bool movementInform); |
