mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Movement: Add some extra assertions to MotionMaster to catch issues like #22444 earlier in the future.
(cherry picked from commit ead439fbd6)
This commit is contained in:
@@ -130,8 +130,6 @@ void WorldSession::SendDoFlight(uint32 mountDisplayId, uint32 path, uint32 pathN
|
||||
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
|
||||
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
GetPlayer()->GetMotionMaster()->Remove(FLIGHT_MOTION_TYPE);
|
||||
|
||||
if (mountDisplayId)
|
||||
GetPlayer()->Mount(mountDisplayId);
|
||||
|
||||
|
||||
@@ -974,7 +974,8 @@ void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
|
||||
TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveTaxiFlight: '%s', taxi to path Id: %u (node %u)", _owner->GetGUID().ToString().c_str(), path, pathnode);
|
||||
|
||||
// Only one FLIGHT_MOTION_TYPE is allowed
|
||||
Remove(FLIGHT_MOTION_TYPE);
|
||||
bool hasExisting = HasMovementGenerator([](MovementGenerator const* gen) { return gen->GetMovementGeneratorType() == FLIGHT_MOTION_TYPE; });
|
||||
ASSERT(!hasExisting, "Duplicate flight path movement generator");
|
||||
|
||||
FlightPathMovementGenerator* movement = new FlightPathMovementGenerator();
|
||||
movement->LoadPath(_owner->ToPlayer(), pathnode);
|
||||
|
||||
@@ -256,7 +256,10 @@ void FlightPathMovementGenerator::InitEndGridInfo()
|
||||
uint32 nodeCount = _path.size(); //! Number of nodes in path.
|
||||
ASSERT(nodeCount, "FlightPathMovementGenerator::InitEndGridInfo() called with empty _path");
|
||||
_endMapId = _path[nodeCount - 1]->ContinentID; //! MapId of last node
|
||||
_preloadTargetNode = nodeCount - 3;
|
||||
if (nodeCount < 3)
|
||||
_preloadTargetNode = 0;
|
||||
else
|
||||
_preloadTargetNode = nodeCount - 3;
|
||||
_endGridX = _path[nodeCount - 1]->Loc.X;
|
||||
_endGridY = _path[nodeCount - 1]->Loc.Y;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class FlightPathMovementGenerator : public MovementGeneratorMedium<Player, Fligh
|
||||
uint32 GetPathAtMapEnd() const;
|
||||
bool HasArrived() const { return _currentNode >= _path.size(); }
|
||||
|
||||
void LoadPath(Player* owner, uint32 startNode = 0);
|
||||
void LoadPath(Player* owner, uint32 startNode = 0); // called from MotionMaster
|
||||
void SetCurrentNodeAfterTeleport();
|
||||
void SkipCurrentNode() { ++_currentNode; }
|
||||
void DoEventIfAny(Player* owner, TaxiPathNodeEntry const* node, bool departure);
|
||||
|
||||
Reference in New Issue
Block a user