[9209] Finish synchonization walk mode for pets.

* Re-sync at follow mode switches
* Support sync for creature pets

Also
* Attempt fix build at *nix
* Drop unused unut state mask with typo in name.
This commit is contained in:
VladimirMangos 2010-01-18 14:27:38 +03:00
parent 6a2e8064f1
commit e1d0c1cdba
9 changed files with 62 additions and 27 deletions

View file

@ -226,10 +226,23 @@ void ChaseMovementGenerator<T>::Reset(T &owner)
}
//-----------------------------------------------//
template<>
void FollowMovementGenerator<Creature>::_updateWalkMode(Creature &u)
{
if (i_target.isValid() && u.isPet())
u.UpdateWalkMode(i_target.getTarget());
}
template<>
void FollowMovementGenerator<Player>::_updateWalkMode(Player &)
{
}
template<>
void FollowMovementGenerator<Player>::Initialize(Player &owner)
{
owner.addUnitState(UNIT_STAT_FOLLOW|UNIT_STAT_FOLLOW_MOVE);
_updateWalkMode(owner);
_setTargetLocation(owner);
}
@ -237,6 +250,7 @@ template<>
void FollowMovementGenerator<Creature>::Initialize(Creature &owner)
{
owner.addUnitState(UNIT_STAT_FOLLOW|UNIT_STAT_FOLLOW_MOVE);
_updateWalkMode(owner);
if (((Creature*)&owner)->canFly())
owner.AddMonsterMoveFlag(MONSTER_MOVE_FLY);
@ -248,12 +262,14 @@ template<class T>
void FollowMovementGenerator<T>::Finalize(T &owner)
{
owner.clearUnitState(UNIT_STAT_FOLLOW|UNIT_STAT_FOLLOW_MOVE);
_updateWalkMode(owner);
}
template<class T>
void FollowMovementGenerator<T>::Interrupt(T &owner)
{
owner.clearUnitState(UNIT_STAT_FOLLOW|UNIT_STAT_FOLLOW_MOVE);
_updateWalkMode(owner);
}
template<class T>