diff options
author | Chaplain <aionthefirst@gmail.com> | 2012-01-15 21:25:03 +0300 |
---|---|---|
committer | Chaplain <aionthefirst@gmail.com> | 2012-01-15 21:25:03 +0300 |
commit | 6bb48a2a872b6da451deb78df1e657f57df14dfb (patch) | |
tree | 10686a66197103bb79401b0070a8c3038bf714f0 | |
parent | f203da224e647023875ae5fd06e65a648fbde1ae (diff) |
Core/Movegen: Fix logic in WaypointMovementGenerator<Creature>::StartMove
-rwxr-xr-x | src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index ea858eaba84..ce8628af1ca 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -84,6 +84,7 @@ void WaypointMovementGenerator<Creature>::OnArrived(Creature& creature) // Inform script MovementInform(creature); + creature.UpdateWaypointID(i_currentNode); Stop(i_path->at(i_currentNode)->delay); } @@ -94,13 +95,11 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature &creature) if (Stopped()) return true; - const WaypointData *node = i_path->at(i_currentNode); - if (m_isArrivalDone) { if ((i_currentNode == i_path->size() - 1) && !repeating) // If that's our last waypoint { - creature.SetHomePosition(node->x, node->y, node->z, creature.GetOrientation()); + creature.SetHomePosition(i_path->at(i_currentNode)->x, i_path->at(i_currentNode)->y, i_path->at(i_currentNode)->z, creature.GetOrientation()); creature.GetMotionMaster()->Initialize(); return false; } @@ -108,6 +107,8 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature &creature) i_currentNode = (i_currentNode+1) % i_path->size(); } + const WaypointData *node = i_path->at(i_currentNode); + m_isArrivalDone = false; creature.AddUnitState(UNIT_STAT_ROAMING_MOVE); |