diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index e8aaf8f86b7..5f3df9aea25 100644 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -82,14 +82,21 @@ struct MovementGeneratorInformation std::string TargetName; }; +static bool EmptyValidator() +{ + return true; +} + class MotionMasterDelayedAction { public: - explicit MotionMasterDelayedAction(std::function&& action, MotionMasterDelayedActionType type) : Action(std::move(action)), Type(type) { } + explicit MotionMasterDelayedAction(std::function&& action, std::function&& validator, MotionMasterDelayedActionType type) : Action(std::move(action)), Validator(std::move(validator)), Type(type) { } + explicit MotionMasterDelayedAction(std::function&& action, MotionMasterDelayedActionType type) : Action(std::move(action)), Validator(EmptyValidator), Type(type) { } ~MotionMasterDelayedAction() { } - void Resolve() { Action(); } + void Resolve() { if (Validator()) Action(); } + std::function Validator; std::function Action; uint8 Type; };