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?
This commit is contained in:
ccrs
2017-11-20 19:47:23 +01:00
parent 4d338b1d4d
commit 2ce9a0a094

View File

@@ -252,16 +252,15 @@ bool WaypointMovementGenerator<Creature>::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<Creature>::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<Creature>::MovementInform(Creature* creature)
{