From 2ce9a0a094a3d86a86a9323693c93ed6a2bbcaaf Mon Sep 17 00:00:00 2001 From: ccrs Date: Mon, 20 Nov 2017 19:47:23 +0100 Subject: Core/Movement: some corrections on WaypointMovementGenerator - Since a timer can be set on MovementGenerator::Pause, dont update it till the movespline is Finalized - Don't set HomePosition on every Update, check if movespline is Finalized * This is still doesnt feel correct, should it only be called on WaypointNode Start? --- .../WaypointMovementGenerator.cpp | 28 +++++++++++++--------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index 3fba420059e..74a8588163c 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -252,16 +252,15 @@ bool WaypointMovementGenerator::DoUpdate(Creature* creature, uint32 di if (!_nextMoveTime.Passed()) { - _nextMoveTime.Update(diff); - if (_nextMoveTime.Passed()) - return StartMoveNow(creature); + if (creature->movespline->Finalized()) + { + _nextMoveTime.Update(diff); + if (_nextMoveTime.Passed()) + return StartMoveNow(creature); + } } else { - // Set home position at place on waypoint movement. - if (!creature->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) || creature->GetTransGUID().IsEmpty()) - creature->SetHomePosition(creature->GetPosition()); - if (creature->movespline->Finalized()) { OnArrived(creature); @@ -270,14 +269,21 @@ bool WaypointMovementGenerator::DoUpdate(Creature* creature, uint32 di if (_nextMoveTime.Passed()) return StartMove(creature); } - else if (_recalculateSpeed) + else { - if (_nextMoveTime.Passed()) - StartMove(creature); + // Set home position at place on waypoint movement. + if (!creature->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) || creature->GetTransGUID().IsEmpty()) + creature->SetHomePosition(creature->GetPosition()); + + if (_recalculateSpeed) + { + if (_nextMoveTime.Passed()) + StartMove(creature); + } } } return true; - } +} void WaypointMovementGenerator::MovementInform(Creature* creature) { -- cgit v1.2.3