[11727] Interrupt spline movement at teleporting

this fixes the position desync issue caused by teleport packets
This commit is contained in:
SilverIce 2011-07-09 19:23:42 +03:00
parent e246d8d94e
commit 94133107c7
5 changed files with 13 additions and 2 deletions

View file

@ -10393,6 +10393,8 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
void Unit::NearTeleportTo( float x, float y, float z, float orientation, bool casting /*= false*/ )
{
DisableSpline();
if(GetTypeId() == TYPEID_PLAYER)
((Player*)this)->TeleportTo(GetMapId(), x, y, z, orientation, TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (casting ? TELE_TO_SPELL : 0));
else
@ -10808,7 +10810,7 @@ void Unit::UpdateSplineMovement(uint32 t_diff)
bool arrived = movespline->Finalized();
if (arrived)
m_movementInfo.RemoveMovementFlag(MovementFlags(MOVEFLAG_SPLINE_ENABLED|MOVEFLAG_FORWARD));
DisableSpline();
m_movesplineTimer.Update(t_diff);
if (m_movesplineTimer.Passed() || arrived)
@ -10822,3 +10824,9 @@ void Unit::UpdateSplineMovement(uint32 t_diff)
GetMap()->CreatureRelocation((Creature*)this,loc.x,loc.y,loc.z,loc.orientation);
}
}
void Unit::DisableSpline()
{
m_movementInfo.RemoveMovementFlag(MovementFlags(MOVEFLAG_SPLINE_ENABLED|MOVEFLAG_FORWARD));
movespline->_Interrupt();
}