diff options
Diffstat (limited to 'src/server/game/Movement/MotionMaster.h')
-rw-r--r-- | src/server/game/Movement/MotionMaster.h | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index a0057ffb036..4db648d7d1f 100644 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -87,23 +87,26 @@ static bool EmptyValidator() return true; } -class MotionMasterDelayedAction +class TC_GAME_API MotionMaster { public: - explicit MotionMasterDelayedAction(std::function<void()>&& action, std::function<bool()>&& validator, MotionMasterDelayedActionType type) : Action(std::move(action)), Validator(std::move(validator)), Type(type) { } - explicit MotionMasterDelayedAction(std::function<void()>&& action, MotionMasterDelayedActionType type) : Action(std::move(action)), Validator(EmptyValidator), Type(type) { } - ~MotionMasterDelayedAction() { } + typedef std::function<void()> DelayedActionDefine; + typedef std::function<bool()> DelayedActionValidator; - void Resolve() { if (Validator()) Action(); } + class DelayedAction + { + public: + explicit DelayedAction(DelayedActionDefine&& action, DelayedActionValidator&& validator, MotionMasterDelayedActionType type) : Action(std::move(action)), Validator(std::move(validator)), Type(type) { } + explicit DelayedAction(DelayedActionDefine&& action, MotionMasterDelayedActionType type) : Action(std::move(action)), Validator(EmptyValidator), Type(type) { } + ~DelayedAction() { } - std::function<void()> Action; - std::function<bool()> Validator; - uint8 Type; -}; + void Resolve() { if (Validator()) Action(); } + + DelayedActionDefine Action; + DelayedActionValidator Validator; + uint8 Type; + }; -class TC_GAME_API MotionMaster -{ - public: explicit MotionMaster(Unit* unit); ~MotionMaster(); @@ -213,7 +216,7 @@ class TC_GAME_API MotionMaster MovementGeneratorPointer _defaultGenerator; MotionMasterContainer _generators; MotionMasterUnitStatesContainer _baseUnitStatesMap; - std::deque<MotionMasterDelayedAction> _delayedActions; + std::deque<DelayedAction> _delayedActions; uint8 _flags; }; |