Core/Movement: move MoveSplineInit (#21857)

The number of edge cases in which weirdness is seen on "effect movements" will be kinda reduced, plus consistency, plus movementInform on custom movement spline initalizations.

Core/Movement: use helpers for validation

Core/Movement: crashfix workaround
This commit is contained in:
ccrs authored and Ovahlord committed 2019-10-06 04:55:46 +02:00
1 parent 88cd3626cb
commit 94980ab362
21 files changed
+649 -733

No files matched your search

+4 -4
View File
@@ -544,7 +544,7 @@ void Unit::MonsterMoveWithSpeed(float x, float y, float z, float speed, bool gen
Movement::MoveSplineInit init(this);
init.MoveTo(x, y, z, generatePath, forceDestination);
init.SetVelocity(speed);
init.Launch();
GetMotionMaster()->LaunchMoveSpline(std::move(init), 0, MOTION_SLOT_ACTIVE, POINT_MOTION_TYPE);
}
void Unit::UpdateSplineMovement(uint32 t_diff)
@@ -11051,7 +11051,7 @@ void Unit::StopMoving()
void Unit::PauseMovement(uint32 timer/* = 0*/, uint8 slot/* = 0*/, bool forced/* = true*/)
{
if (slot >= MAX_MOTION_SLOT)
if (IsInvalidMovementSlot(slot))
return;
if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(MovementSlot(slot)))
@@ -11063,7 +11063,7 @@ void Unit::PauseMovement(uint32 timer/* = 0*/, uint8 slot/* = 0*/, bool forced/*
void Unit::ResumeMovement(uint32 timer/* = 0*/, uint8 slot/* = 0*/)
{
if (slot >= MAX_MOTION_SLOT)
if (IsInvalidMovementSlot(slot))
return;
if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(MovementSlot(slot)))
@@ -13547,7 +13547,7 @@ void Unit::_ExitVehicle(Position const* exitPosition)
init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), height, false);
init.SetFacing(GetOrientation());
init.SetTransportExit();
init.Launch();
GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_VEHICLE_EXIT, MOTION_SLOT_CONTROLLED);
if (player)
player->ResummonPetTemporaryUnSummonedIfAny();