diff options
author | Subv <s.v.h21@hotmail.com> | 2013-05-31 12:38:05 -0500 |
---|---|---|
committer | Subv <s.v.h21@hotmail.com> | 2013-05-31 12:38:05 -0500 |
commit | 905ca8e1e4eba81b4183873731ce4ad6475a136b (patch) | |
tree | 224005394efce692d21e4acd9fe9f7b638e80fc0 | |
parent | 6fe923fdd3a6b2d245e84581d776960440b49027 (diff) |
Core/Movement: Follower creatures in a formation will now follow their leader when the leader was moved with PointMovementGenerator
-rwxr-xr-x | src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp index ea7a8c4c710..51a23b84342 100755 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp @@ -42,6 +42,11 @@ void PointMovementGenerator<T>::DoInitialize(T* unit) if (speed > 0.0f) init.SetVelocity(speed); init.Launch(); + + //Call for creature group update + if (Creature* creature = unit->ToCreature()) + if (creature->GetFormation() && creature->GetFormation()->getLeader() == creature) + creature->GetFormation()->LeaderMoveTo(i_x, i_y, i_z); } template<class T> @@ -66,6 +71,11 @@ bool PointMovementGenerator<T>::DoUpdate(T* unit, uint32 /*diff*/) if (speed > 0.0f) // Default value for point motion type is 0.0, if 0.0 spline will use GetSpeed on unit init.SetVelocity(speed); init.Launch(); + + //Call for creature group update + if (Creature* creature = unit->ToCreature()) + if (creature->GetFormation() && creature->GetFormation()->getLeader() == creature) + creature->GetFormation()->LeaderMoveTo(i_x, i_y, i_z); } return !unit->movespline->Finalized(); |