mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[11721] Simplify walk/run movement mode selection code
This commit is contained in:
parent
9d566398ad
commit
fc0eb7e9fa
10 changed files with 10 additions and 54 deletions
|
|
@ -83,6 +83,7 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T &owner)
|
|||
|
||||
Movement::MoveSplineInit init(owner);
|
||||
init.MoveTo(x,y,z);
|
||||
init.SetWalk(((D*)this)->EnableWalking());
|
||||
init.Launch();
|
||||
}
|
||||
|
||||
|
|
@ -216,15 +217,15 @@ void ChaseMovementGenerator<T>::Reset(T &owner)
|
|||
|
||||
//-----------------------------------------------//
|
||||
template<>
|
||||
void FollowMovementGenerator<Creature>::_updateWalkMode(Creature &u)
|
||||
bool FollowMovementGenerator<Creature>::EnableWalking() const
|
||||
{
|
||||
if (i_target.isValid() && u.IsPet())
|
||||
u.UpdateWalkMode(i_target.getTarget());
|
||||
return i_target.isValid() && i_target->IsWalking();
|
||||
}
|
||||
|
||||
template<>
|
||||
void FollowMovementGenerator<Player>::_updateWalkMode(Player &)
|
||||
bool FollowMovementGenerator<Player>::EnableWalking() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template<>
|
||||
|
|
@ -249,7 +250,6 @@ template<>
|
|||
void FollowMovementGenerator<Player>::Initialize(Player &owner)
|
||||
{
|
||||
owner.addUnitState(UNIT_STAT_FOLLOW|UNIT_STAT_FOLLOW_MOVE);
|
||||
_updateWalkMode(owner);
|
||||
_updateSpeed(owner);
|
||||
_setTargetLocation(owner);
|
||||
}
|
||||
|
|
@ -258,7 +258,6 @@ template<>
|
|||
void FollowMovementGenerator<Creature>::Initialize(Creature &owner)
|
||||
{
|
||||
owner.addUnitState(UNIT_STAT_FOLLOW|UNIT_STAT_FOLLOW_MOVE);
|
||||
_updateWalkMode(owner);
|
||||
_updateSpeed(owner);
|
||||
_setTargetLocation(owner);
|
||||
}
|
||||
|
|
@ -267,7 +266,6 @@ template<class T>
|
|||
void FollowMovementGenerator<T>::Finalize(T &owner)
|
||||
{
|
||||
owner.clearUnitState(UNIT_STAT_FOLLOW|UNIT_STAT_FOLLOW_MOVE);
|
||||
_updateWalkMode(owner);
|
||||
_updateSpeed(owner);
|
||||
}
|
||||
|
||||
|
|
@ -275,7 +273,6 @@ template<class T>
|
|||
void FollowMovementGenerator<T>::Interrupt(T &owner)
|
||||
{
|
||||
owner.clearUnitState(UNIT_STAT_FOLLOW|UNIT_STAT_FOLLOW_MOVE);
|
||||
_updateWalkMode(owner);
|
||||
_updateSpeed(owner);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue