diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/MotionMaster.cpp | 8 | ||||
-rw-r--r-- | src/game/MotionMaster.h | 4 | ||||
-rw-r--r-- | src/game/Unit.cpp | 2 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp index b64c17b6342..170a9b52211 100644 --- a/src/game/MotionMaster.cpp +++ b/src/game/MotionMaster.cpp @@ -460,6 +460,14 @@ MovementGeneratorType MotionMaster::GetCurrentMovementGeneratorType() const return top()->GetMovementGeneratorType(); } +MovementGeneratorType MotionMaster::GetMotionSlotType(int slot) const +{ + if(!Impl[slot]) + return NULL_MOTION_TYPE; + else + return Impl[slot]->GetMovementGeneratorType(); +} + void MotionMaster::InitTop() { top()->Initialize(*i_owner); diff --git a/src/game/MotionMaster.h b/src/game/MotionMaster.h index bf3560da321..d68a94b7a1f 100644 --- a/src/game/MotionMaster.h +++ b/src/game/MotionMaster.h @@ -45,6 +45,7 @@ enum MovementGeneratorType POINT_MOTION_TYPE = 8, // PointMovementGenerator.h FLEEING_MOTION_TYPE = 9, // FleeingMovementGenerator.h DISTRACT_MOTION_TYPE = 10, // IdleMovementGenerator.h + NULL_MOTION_TYPE = 11, }; enum MovementSlot @@ -94,7 +95,7 @@ class TRINITY_DLL_SPEC MotionMaster //: private std::stack<MovementGenerator *> int size() const { return i_top + 1; } _Ty top() const { return Impl[i_top]; } - _Ty GetMotionSlot(int slot) { return Impl[slot]; } + _Ty GetMotionSlot(int slot) const { return Impl[slot]; } void DirectDelete(_Ty curr); void DelayedDelete(_Ty curr); @@ -141,6 +142,7 @@ class TRINITY_DLL_SPEC MotionMaster //: private std::stack<MovementGenerator *> void MovePath(uint32 path_id, bool repeatable); MovementGeneratorType GetCurrentMovementGeneratorType() const; + MovementGeneratorType GetMotionSlotType(int slot) const; void propagateSpeedChange(); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 50fc8c149b7..2c2d38f8f19 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -9925,7 +9925,7 @@ void Unit::SetInCombatState(bool PvP) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - if(GetTypeId() != TYPEID_PLAYER) + if(GetTypeId() != TYPEID_PLAYER && GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_IDLE) != IDLE_MOTION_TYPE) ((Creature*)this)->SetHomePosition(GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); if(GetTypeId() != TYPEID_PLAYER && ((Creature*)this)->isPet()) |