[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

@ -1759,6 +1759,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// reset movement flags at teleport, because player will continue move with these flags after teleport
m_movementInfo.SetMovementFlags(MOVEFLAG_NONE);
DisableSpline();
if ((GetMapId() == mapid) && (!m_transport))
{

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();
}

View file

@ -2010,6 +2010,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
private:
void CleanupDeletedAuras();
void UpdateSplineMovement(uint32 t_diff);
void DisableSpline();
// player or player's pet
float GetCombatRatingReduction(CombatRating cr) const;

View file

@ -85,6 +85,7 @@ namespace Movement
const MySpline& _Spline() const { return spline;}
int32 _currentSplineIdx() const { return point_Idx;}
void _Finalize();
void _Interrupt() { splineflags.done = true;}
#pragma endregion
public:

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11726"
#define REVISION_NR "11727"
#endif // __REVISION_NR_H__