@@ -434,7 +434,7 @@ void Unit::Update(uint32 p_time)
434434 // WARNING! Order of execution here is important, do not change.
435435 // Spells must be processed with event system BEFORE they go to _UpdateSpells.
436436 // Or else we may have some SPELL_STATE_FINISHED spells stalled in pointers, that is bad.
437- m_Events. Update (p_time);
437+ WorldObject:: Update (p_time);
438438
439439 CheckPendingMovementAcks ();
440440
@@ -499,6 +499,14 @@ void Unit::Update(uint32 p_time)
499499 RefreshAI ();
500500}
501501
502+ void Unit::Heartbeat ()
503+ {
504+ WorldObject::Heartbeat ();
505+
506+ // SMSG_FLIGHT_SPLINE_SYNC for cyclic splines
507+ SendFlightSplineSyncUpdate ();
508+ }
509+
502510bool Unit::haveOffhandWeapon () const
503511{
504512 if (Player const * player = ToPlayer ())
@@ -525,20 +533,6 @@ void Unit::UpdateSplineMovement(uint32 t_diff)
525533 movespline->updateState (t_diff);
526534 bool arrived = movespline->Finalized ();
527535
528- if (movespline->isCyclic ())
529- {
530- m_splineSyncTimer.Update (t_diff);
531- if (m_splineSyncTimer.Passed ())
532- {
533- m_splineSyncTimer.Reset (5000 ); // Retail value, do not change
534-
535- WorldPacket data (SMSG_FLIGHT_SPLINE_SYNC, 4 + GetPackGUID ().size ());
536- Movement::PacketBuilder::WriteSplineSync (*movespline, data);
537- data << GetPackGUID ();
538- SendMessageToSet (&data, true );
539- }
540- }
541-
542536 if (arrived)
543537 {
544538 DisableSpline ();
@@ -574,6 +568,17 @@ void Unit::UpdateSplinePosition()
574568 UpdatePosition (loc.x , loc.y , loc.z , loc.orientation );
575569}
576570
571+ void Unit::SendFlightSplineSyncUpdate ()
572+ {
573+ if (!movespline->isCyclic () || movespline->Finalized ())
574+ return ;
575+
576+ WorldPacket data (SMSG_FLIGHT_SPLINE_SYNC, 4 + GetPackGUID ().size ());
577+ Movement::PacketBuilder::WriteSplineSync (*movespline, data);
578+ data << GetPackGUID ();
579+ SendMessageToSet (&data, true );
580+ }
581+
577582void Unit::InterruptMovementBasedAuras ()
578583{
579584 // TODO: Check if orientation transport offset changed instead of only global orientation
@@ -9666,7 +9671,6 @@ void Unit::CleanupBeforeRemoveFromMap(bool finalCleanup)
96669671 if (finalCleanup)
96679672 m_cleanupDone = true ;
96689673
9669- m_Events.KillAllEvents (false ); // non-delatable (currently cast spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList
96709674 CombatStop ();
96719675 ClearComboPoints ();
96729676 ClearComboPointHolders ();
0 commit comments