*Fix a bug that mobs do not return home after wipe.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-03-15 10:50:10 -06:00
parent 3421942b2b
commit abe53c5cb6
3 changed files with 12 additions and 2 deletions
+8
View File
@@ -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);
+3 -1
View File
@@ -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();
+1 -1
View File
@@ -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())