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:
Treeston
2018-10-02 19:53:55 +02:00
committed by Shauren
parent d59854d176
commit 792914fb51
4 changed files with 7 additions and 5 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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);