diff options
author | jackpoz <giacomopoz@gmail.com> | 2020-03-21 17:42:24 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-12-30 20:59:20 +0100 |
commit | 37543109f67a655cc4c08668d49c26ec16fc31c1 (patch) | |
tree | 42a95edabddf244ee180cf9e35e23ee1298c32ed /src | |
parent | 040af829ca7d1148a99c3ac03a3383c58af9e23c (diff) |
Core/Movement: Don't start a spline with just 1 point in FlightPathMovementGenerator
Don't start a spline with just 1 point in FlightPathMovementGenerator. This happens when teleporting to a BG while on a taxi after second last node but closer to last node.
In this case the Player will be teleported to the last node.
(cherry picked from commit ec495764918506193a51f00247adb432b1ba6646)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Movement/MovementGenerators/FlightPathMovementGenerator.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/server/game/Movement/MovementGenerators/FlightPathMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FlightPathMovementGenerator.cpp index 28bc55f33bb..76d6f86854b 100644 --- a/src/server/game/Movement/MovementGenerators/FlightPathMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/FlightPathMovementGenerator.cpp @@ -75,11 +75,19 @@ void FlightPathMovementGenerator::DoReset(Player* owner) owner->CombatStopWithPets(); owner->AddUnitFlag(UnitFlags(UNIT_FLAG_REMOVE_CLIENT_CONTROL | UNIT_FLAG_TAXI_FLIGHT)); + uint32 end = GetPathAtMapEnd(); + uint32 currentNodeId = GetCurrentNode(); + + if (currentNodeId == end) + { + TC_LOG_DEBUG("movement.flightpath", "FlightPathMovementGenerator::DoReset: trying to start a flypath from the end point. %s", owner->GetDebugInfo().c_str()); + return; + } + Movement::MoveSplineInit init(owner); // Providing a starting vertex since the taxi paths do not provide such init.Path().push_back(G3D::Vector3(owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ())); - uint32 end = GetPathAtMapEnd(); - for (uint32 i = GetCurrentNode(); i != end; ++i) + for (uint32 i = currentNodeId; i != end; ++i) { G3D::Vector3 vertice(_path[i]->Loc.X, _path[i]->Loc.Y, _path[i]->Loc.Z); init.Path().push_back(vertice); |