aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2020-03-21 17:42:24 +0100
committerjackpoz <giacomopoz@gmail.com>2020-03-21 17:42:24 +0100
commitec495764918506193a51f00247adb432b1ba6646 (patch)
tree9d510e4c32df2bd85c7d3118a9e60226ec63bde7 /src
parent296f6aab402407a2798f3a300b256cc75d59fec4 (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.
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Movement/MovementGenerators/FlightPathMovementGenerator.cpp12
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 d9628fe0089..21ae1a4abd7 100644
--- a/src/server/game/Movement/MovementGenerators/FlightPathMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/FlightPathMovementGenerator.cpp
@@ -74,11 +74,19 @@ void FlightPathMovementGenerator::DoReset(Player* owner)
owner->CombatStopWithPets();
owner->SetFlag(UNIT_FIELD_FLAGS, 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]->LocX, _path[i]->LocY, _path[i]->LocZ);
init.Path().push_back(vertice);