aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Handlers/MovementHandler.cpp2
-rw-r--r--src/server/game/Handlers/TaxiHandler.cpp2
-rw-r--r--src/server/game/Movement/MotionMaster.cpp1
-rw-r--r--src/server/game/Movement/MovementGenerators/FlightPathMovementGenerator.cpp245
-rw-r--r--src/server/game/Movement/MovementGenerators/FlightPathMovementGenerator.h68
-rw-r--r--src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp226
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h44
7 files changed, 317 insertions, 271 deletions
diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp
index 9f7c2532005..45a502d35e7 100644
--- a/src/server/game/Handlers/MovementHandler.cpp
+++ b/src/server/game/Handlers/MovementHandler.cpp
@@ -19,6 +19,7 @@
#include "Battleground.h"
#include "Common.h"
#include "Corpse.h"
+#include "FlightPathMovementGenerator.h"
#include "GameTime.h"
#include "Garrison.h"
#include "InstancePackets.h"
@@ -34,7 +35,6 @@
#include "MovementGenerator.h"
#include "Transport.h"
#include "Vehicle.h"
-#include "WaypointMovementGenerator.h"
#include "SpellMgr.h"
#define MOVEMENT_PACKET_TIME_DELAY 0
diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp
index 52d5521a733..2b8c1098e8c 100644
--- a/src/server/game/Handlers/TaxiHandler.cpp
+++ b/src/server/game/Handlers/TaxiHandler.cpp
@@ -22,6 +22,7 @@
#include "Creature.h"
#include "DatabaseEnv.h"
#include "DB2Stores.h"
+#include "FlightPathMovementGenerator.h"
#include "Log.h"
#include "MotionMaster.h"
#include "ObjectAccessor.h"
@@ -29,7 +30,6 @@
#include "Player.h"
#include "TaxiPackets.h"
#include "TaxiPathGraph.h"
-#include "WaypointMovementGenerator.h"
void WorldSession::HandleEnableTaxiNodeOpcode(WorldPackets::Taxi::EnableTaxiNode& enableTaxiNode)
{
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp
index b3d0e45339b..55719daad2c 100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -21,6 +21,7 @@
#include "CreatureAISelector.h"
#include "DB2Stores.h"
#include "FleeingMovementGenerator.h"
+#include "FlightPathMovementGenerator.h"
#include "FormationMovementGenerator.h"
#include "HomeMovementGenerator.h"
#include "IdleMovementGenerator.h"
diff --git a/src/server/game/Movement/MovementGenerators/FlightPathMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FlightPathMovementGenerator.cpp
new file mode 100644
index 00000000000..483ebc4841f
--- /dev/null
+++ b/src/server/game/Movement/MovementGenerators/FlightPathMovementGenerator.cpp
@@ -0,0 +1,245 @@
+/*
+ * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "FlightPathMovementGenerator.h"
+#include "DB2Stores.h"
+#include "Log.h"
+#include "MapManager.h"
+#include "MoveSpline.h"
+#include "MoveSplineInit.h"
+#include "ObjectMgr.h"
+#include "Player.h"
+
+ //----------------------------------------------------//
+
+#define FLIGHT_TRAVEL_UPDATE 100
+#define TIMEDIFF_NEXT_WP 250
+#define SKIP_SPLINE_POINT_DISTANCE_SQ (40.f * 40.f)
+#define PLAYER_FLIGHT_SPEED 32.0f
+
+FlightPathMovementGenerator::FlightPathMovementGenerator()
+{
+ _currentNode = 0;
+ _endGridX = 0.0f;
+ _endGridY = 0.0f;
+ _endMapId = 0;
+ _preloadTargetNode = 0;
+}
+
+uint32 FlightPathMovementGenerator::GetPathAtMapEnd() const
+{
+ if (_currentNode >= _path.size())
+ return _path.size();
+
+ uint32 curMapId = _path[_currentNode]->ContinentID;
+ for (uint32 itr = _currentNode; itr < _path.size(); ++itr)
+ if (_path[itr]->ContinentID != curMapId)
+ return itr;
+
+ return _path.size();
+}
+
+bool IsNodeIncludedInShortenedPath(TaxiPathNodeEntry const* p1, TaxiPathNodeEntry const* p2)
+{
+ return p1->ContinentID != p2->ContinentID || std::pow(p1->Loc.X - p2->Loc.X, 2) + std::pow(p1->Loc.Y - p2->Loc.Y, 2) > SKIP_SPLINE_POINT_DISTANCE_SQ;
+}
+
+void FlightPathMovementGenerator::LoadPath(Player* player, uint32 startNode /*= 0*/)
+{
+ _path.clear();
+ _currentNode = startNode;
+ _pointsForPathSwitch.clear();
+ std::deque<uint32> const& taxi = player->m_taxi.GetPath();
+ float discount = player->GetReputationPriceDiscount(player->m_taxi.GetFlightMasterFactionTemplate());
+ for (uint32 src = 0, dst = 1; dst < taxi.size(); src = dst++)
+ {
+ uint32 path, cost;
+ sObjectMgr->GetTaxiPath(taxi[src], taxi[dst], path, cost);
+ if (path > sTaxiPathNodesByPath.size())
+ return;
+
+ TaxiPathNodeList const& nodes = sTaxiPathNodesByPath[path];
+ if (!nodes.empty())
+ {
+ TaxiPathNodeEntry const* start = nodes[0];
+ TaxiPathNodeEntry const* end = nodes[nodes.size() - 1];
+ bool passedPreviousSegmentProximityCheck = false;
+ for (uint32 i = 0; i < nodes.size(); ++i)
+ {
+ if (passedPreviousSegmentProximityCheck || !src || _path.empty() || IsNodeIncludedInShortenedPath(_path.back(), nodes[i]))
+ {
+ if ((!src || (IsNodeIncludedInShortenedPath(start, nodes[i]) && i >= 2)) &&
+ (dst == taxi.size() - 1 || (IsNodeIncludedInShortenedPath(end, nodes[i]) && i < nodes.size() - 1)))
+ {
+ passedPreviousSegmentProximityCheck = true;
+ _path.push_back(nodes[i]);
+ }
+ }
+ else
+ {
+ _path.pop_back();
+ --_pointsForPathSwitch.back().PathIndex;
+ }
+ }
+ }
+
+ _pointsForPathSwitch.push_back({ uint32(_path.size() - 1), int64(ceil(cost * discount)) });
+ }
+}
+
+void FlightPathMovementGenerator::DoInitialize(Player* player)
+{
+ Reset(player);
+ InitEndGridInfo();
+}
+
+void FlightPathMovementGenerator::DoFinalize(Player* player)
+{
+ // remove flag to prevent send object build movement packets for flight state and crash (movement generator already not at top of stack)
+ player->ClearUnitState(UNIT_STATE_IN_FLIGHT);
+
+ player->Dismount();
+ player->RemoveUnitFlag(UnitFlags(UNIT_FLAG_REMOVE_CLIENT_CONTROL | UNIT_FLAG_TAXI_FLIGHT));
+
+ if (player->m_taxi.empty())
+ {
+ player->getHostileRefManager().setOnlineOfflineState(true);
+ // update z position to ground and orientation for landing point
+ // this prevent cheating with landing point at lags
+ // when client side flight end early in comparison server side
+ player->StopMoving();
+ player->SetFallInformation(0, player->GetPositionZ());
+ }
+
+ player->RemovePlayerFlag(PLAYER_FLAGS_TAXI_BENCHMARK);
+ player->RestoreDisplayId();
+}
+
+void FlightPathMovementGenerator::DoReset(Player* player)
+{
+ player->getHostileRefManager().setOnlineOfflineState(false);
+ player->AddUnitState(UNIT_STATE_IN_FLIGHT);
+ player->AddUnitFlag(UnitFlags(UNIT_FLAG_REMOVE_CLIENT_CONTROL | UNIT_FLAG_TAXI_FLIGHT));
+
+ Movement::MoveSplineInit init(player);
+ uint32 end = GetPathAtMapEnd();
+ for (uint32 i = GetCurrentNode(); i != end; ++i)
+ {
+ G3D::Vector3 vertice(_path[i]->Loc.X, _path[i]->Loc.Y, _path[i]->Loc.Z);
+ init.Path().push_back(vertice);
+ }
+ init.SetFirstPointId(GetCurrentNode());
+ init.SetFly();
+ init.SetSmooth();
+ init.SetUncompressed();
+ init.SetWalk(true);
+ init.SetVelocity(PLAYER_FLIGHT_SPEED);
+ init.Launch();
+}
+
+bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/)
+{
+ uint32 pointId = (uint32)player->movespline->currentPathIdx();
+ if (pointId > _currentNode)
+ {
+ bool departureEvent = true;
+ do
+ {
+ DoEventIfAny(player, _path[_currentNode], departureEvent);
+ while (!_pointsForPathSwitch.empty() && _pointsForPathSwitch.front().PathIndex <= _currentNode)
+ {
+ _pointsForPathSwitch.pop_front();
+ player->m_taxi.NextTaxiDestination();
+ if (!_pointsForPathSwitch.empty())
+ {
+ player->UpdateCriteria(CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING, _pointsForPathSwitch.front().Cost);
+ player->ModifyMoney(-_pointsForPathSwitch.front().Cost);
+ }
+ }
+
+ if (pointId == _currentNode)
+ break;
+
+ if (_currentNode == _preloadTargetNode)
+ PreloadEndGrid();
+ _currentNode += departureEvent ? 1 : 0;
+ departureEvent = !departureEvent;
+ } while (true);
+ }
+
+ return _currentNode < (_path.size() - 1);
+}
+
+void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport()
+{
+ if (_path.empty() || _currentNode >= _path.size())
+ return;
+
+ uint32 map0 = _path[_currentNode]->ContinentID;
+ for (size_t i = _currentNode + 1; i < _path.size(); ++i)
+ {
+ if (_path[i]->ContinentID != map0)
+ {
+ _currentNode = i;
+ return;
+ }
+ }
+}
+
+void FlightPathMovementGenerator::DoEventIfAny(Player* player, TaxiPathNodeEntry const* node, bool departure)
+{
+ if (uint32 eventid = departure ? node->DepartureEventID : node->ArrivalEventID)
+ {
+ TC_LOG_DEBUG("maps.script", "Taxi %s event %u of node %u of path %u for player %s", departure ? "departure" : "arrival", eventid, node->NodeIndex, node->PathID, player->GetName().c_str());
+ player->GetMap()->ScriptsStart(sEventScripts, eventid, player, player);
+ }
+}
+
+bool FlightPathMovementGenerator::GetResetPos(Player*, float& x, float& y, float& z)
+{
+ TaxiPathNodeEntry const* node = _path[_currentNode];
+ x = node->Loc.X;
+ y = node->Loc.Y;
+ z = node->Loc.Z;
+ return true;
+}
+
+void FlightPathMovementGenerator::InitEndGridInfo()
+{
+ /*! Storage to preload flightmaster grid at end of flight. For multi-stop flights, this will
+ be reinitialized for each flightmaster at the end of each spline (or stop) in the flight. */
+ uint32 nodeCount = _path.size(); //! Number of nodes in path.
+ _endMapId = _path[nodeCount - 1]->ContinentID; //! MapId of last node
+ _preloadTargetNode = nodeCount - 3;
+ _endGridX = _path[nodeCount - 1]->Loc.X;
+ _endGridY = _path[nodeCount - 1]->Loc.Y;
+}
+
+void FlightPathMovementGenerator::PreloadEndGrid()
+{
+ // used to preload the final grid where the flightmaster is
+ Map* endMap = sMapMgr->FindBaseNonInstanceMap(_endMapId);
+
+ // Load the grid
+ if (endMap)
+ {
+ TC_LOG_DEBUG("misc", "Preloading rid (%f, %f) for map %u at node index %u/%u", _endGridX, _endGridY, _endMapId, _preloadTargetNode, (uint32)(_path.size() - 1));
+ endMap->LoadGrid(_endGridX, _endGridY);
+ }
+ else
+ TC_LOG_DEBUG("misc", "Unable to determine map to preload flightmaster grid");
+}
diff --git a/src/server/game/Movement/MovementGenerators/FlightPathMovementGenerator.h b/src/server/game/Movement/MovementGenerators/FlightPathMovementGenerator.h
new file mode 100644
index 00000000000..9c8db49a98f
--- /dev/null
+++ b/src/server/game/Movement/MovementGenerators/FlightPathMovementGenerator.h
@@ -0,0 +1,68 @@
+/*
+ * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef FlightPathMovementGenerator_h__
+#define FlightPathMovementGenerator_h__
+
+#include "WaypointMovementGenerator.h"
+
+class Player;
+
+/**
+* FlightPathMovementGenerator generates movement of the player for the paths
+* and hence generates ground and activities for the player.
+*/
+class FlightPathMovementGenerator : public MovementGeneratorMedium<Player, FlightPathMovementGenerator>, public PathMovementBase<Player, std::vector<TaxiPathNodeEntry const*>>
+{
+public:
+ explicit FlightPathMovementGenerator();
+
+ void LoadPath(Player* player, uint32 startNode = 0);
+ void DoInitialize(Player*);
+ void DoReset(Player*);
+ void DoFinalize(Player*);
+ bool DoUpdate(Player*, uint32);
+ MovementGeneratorType GetMovementGeneratorType() const override { return FLIGHT_MOTION_TYPE; }
+
+ std::vector<TaxiPathNodeEntry const*> const& GetPath() { return _path; }
+ uint32 GetPathAtMapEnd() const;
+ bool HasArrived() const { return (_currentNode >= _path.size()); }
+ void SetCurrentNodeAfterTeleport();
+ void SkipCurrentNode() { ++_currentNode; }
+ void DoEventIfAny(Player* player, TaxiPathNodeEntry const* node, bool departure);
+
+ bool GetResetPos(Player*, float& x, float& y, float& z);
+ void InitEndGridInfo();
+ void PreloadEndGrid();
+
+private:
+
+ float _endGridX; //! X coord of last node location
+ float _endGridY; //! Y coord of last node location
+ uint32 _endMapId; //! map Id of last node location
+ uint32 _preloadTargetNode; //! node index where preloading starts
+
+ struct TaxiNodeChangeInfo
+ {
+ uint32 PathIndex;
+ int64 Cost;
+ };
+
+ std::deque<TaxiNodeChangeInfo> _pointsForPathSwitch; //! node indexes and costs where TaxiPath changes
+};
+
+#endif // FlightPathMovementGenerator_h__
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
index e93e5e5be5f..8835131a81a 100644
--- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
@@ -19,15 +19,12 @@
#include "Creature.h"
#include "CreatureAI.h"
#include "Log.h"
-#include "MapManager.h"
+#include "Map.h"
#include "MoveSpline.h"
#include "MoveSplineInit.h"
#include "ObjectMgr.h"
-#include "Player.h"
#include "Transport.h"
-#include "WaypointDefines.h"
#include "WaypointManager.h"
-#include "World.h"
WaypointMovementGenerator<Creature>::WaypointMovementGenerator(uint32 pathId, bool repeating) : _nextMoveTime(0), _recalculateSpeed(false), _isArrivalDone(false), _pathId(pathId),
_repeating(repeating), _loadedFromDB(true), _stalled(false), _done(false)
@@ -327,224 +324,3 @@ bool WaypointMovementGenerator<Creature>::CanMove(Creature* creature)
{
return _nextMoveTime.Passed() && !creature->HasUnitState(UNIT_STATE_NOT_MOVE) && !creature->IsMovementPreventedByCasting();
}
-
-//----------------------------------------------------//
-
-#define FLIGHT_TRAVEL_UPDATE 100
-#define TIMEDIFF_NEXT_WP 250
-#define SKIP_SPLINE_POINT_DISTANCE_SQ (40.f * 40.f)
-#define PLAYER_FLIGHT_SPEED 32.0f
-
-FlightPathMovementGenerator::FlightPathMovementGenerator()
-{
- _currentNode = 0;
- _endGridX = 0.0f;
- _endGridY = 0.0f;
- _endMapId = 0;
- _preloadTargetNode = 0;
-}
-
-uint32 FlightPathMovementGenerator::GetPathAtMapEnd() const
-{
- if (_currentNode >= _path.size())
- return _path.size();
-
- uint32 curMapId = _path[_currentNode]->ContinentID;
- for (uint32 itr = _currentNode; itr < _path.size(); ++itr)
- if (_path[itr]->ContinentID != curMapId)
- return itr;
-
- return _path.size();
-}
-
-bool IsNodeIncludedInShortenedPath(TaxiPathNodeEntry const* p1, TaxiPathNodeEntry const* p2)
-{
- return p1->ContinentID != p2->ContinentID || std::pow(p1->Loc.X - p2->Loc.X, 2) + std::pow(p1->Loc.Y - p2->Loc.Y, 2) > SKIP_SPLINE_POINT_DISTANCE_SQ;
-}
-
-void FlightPathMovementGenerator::LoadPath(Player* player, uint32 startNode /*= 0*/)
-{
- _path.clear();
- _currentNode = startNode;
- _pointsForPathSwitch.clear();
- std::deque<uint32> const& taxi = player->m_taxi.GetPath();
- float discount = player->GetReputationPriceDiscount(player->m_taxi.GetFlightMasterFactionTemplate());
- for (uint32 src = 0, dst = 1; dst < taxi.size(); src = dst++)
- {
- uint32 path, cost;
- sObjectMgr->GetTaxiPath(taxi[src], taxi[dst], path, cost);
- if (path > sTaxiPathNodesByPath.size())
- return;
-
- TaxiPathNodeList const& nodes = sTaxiPathNodesByPath[path];
- if (!nodes.empty())
- {
- TaxiPathNodeEntry const* start = nodes[0];
- TaxiPathNodeEntry const* end = nodes[nodes.size() - 1];
- bool passedPreviousSegmentProximityCheck = false;
- for (uint32 i = 0; i < nodes.size(); ++i)
- {
- if (passedPreviousSegmentProximityCheck || !src || _path.empty() || IsNodeIncludedInShortenedPath(_path.back(), nodes[i]))
- {
- if ((!src || (IsNodeIncludedInShortenedPath(start, nodes[i]) && i >= 2)) &&
- (dst == taxi.size() - 1 || (IsNodeIncludedInShortenedPath(end, nodes[i]) && i < nodes.size() - 1)))
- {
- passedPreviousSegmentProximityCheck = true;
- _path.push_back(nodes[i]);
- }
- }
- else
- {
- _path.pop_back();
- --_pointsForPathSwitch.back().PathIndex;
- }
- }
- }
-
- _pointsForPathSwitch.push_back({ uint32(_path.size() - 1), int64(ceil(cost * discount)) });
- }
-}
-
-void FlightPathMovementGenerator::DoInitialize(Player* player)
-{
- Reset(player);
- InitEndGridInfo();
-}
-
-void FlightPathMovementGenerator::DoFinalize(Player* player)
-{
- // remove flag to prevent send object build movement packets for flight state and crash (movement generator already not at top of stack)
- player->ClearUnitState(UNIT_STATE_IN_FLIGHT);
-
- player->Dismount();
- player->RemoveUnitFlag(UnitFlags(UNIT_FLAG_REMOVE_CLIENT_CONTROL | UNIT_FLAG_TAXI_FLIGHT));
-
- if (player->m_taxi.empty())
- {
- player->getHostileRefManager().setOnlineOfflineState(true);
- // update z position to ground and orientation for landing point
- // this prevent cheating with landing point at lags
- // when client side flight end early in comparison server side
- player->StopMoving();
- player->SetFallInformation(0, player->GetPositionZ());
- }
-
- player->RemovePlayerFlag(PLAYER_FLAGS_TAXI_BENCHMARK);
- player->RestoreDisplayId();
-}
-
-void FlightPathMovementGenerator::DoReset(Player* player)
-{
- player->getHostileRefManager().setOnlineOfflineState(false);
- player->AddUnitState(UNIT_STATE_IN_FLIGHT);
- player->AddUnitFlag(UnitFlags(UNIT_FLAG_REMOVE_CLIENT_CONTROL | UNIT_FLAG_TAXI_FLIGHT));
-
- Movement::MoveSplineInit init(player);
- uint32 end = GetPathAtMapEnd();
- for (uint32 i = GetCurrentNode(); i != end; ++i)
- {
- G3D::Vector3 vertice(_path[i]->Loc.X, _path[i]->Loc.Y, _path[i]->Loc.Z);
- init.Path().push_back(vertice);
- }
- init.SetFirstPointId(GetCurrentNode());
- init.SetFly();
- init.SetSmooth();
- init.SetUncompressed();
- init.SetWalk(true);
- init.SetVelocity(PLAYER_FLIGHT_SPEED);
- init.Launch();
-}
-
-bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/)
-{
- uint32 pointId = (uint32)player->movespline->currentPathIdx();
- if (pointId > _currentNode)
- {
- bool departureEvent = true;
- do
- {
- DoEventIfAny(player, _path[_currentNode], departureEvent);
- while (!_pointsForPathSwitch.empty() && _pointsForPathSwitch.front().PathIndex <= _currentNode)
- {
- _pointsForPathSwitch.pop_front();
- player->m_taxi.NextTaxiDestination();
- if (!_pointsForPathSwitch.empty())
- {
- player->UpdateCriteria(CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING, _pointsForPathSwitch.front().Cost);
- player->ModifyMoney(-_pointsForPathSwitch.front().Cost);
- }
- }
-
- if (pointId == _currentNode)
- break;
-
- if (_currentNode == _preloadTargetNode)
- PreloadEndGrid();
- _currentNode += departureEvent ? 1 : 0;
- departureEvent = !departureEvent;
- }
- while (true);
- }
-
- return _currentNode < (_path.size() - 1);
-}
-
-void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport()
-{
- if (_path.empty() || _currentNode >= _path.size())
- return;
-
- uint32 map0 = _path[_currentNode]->ContinentID;
- for (size_t i = _currentNode + 1; i < _path.size(); ++i)
- {
- if (_path[i]->ContinentID != map0)
- {
- _currentNode = i;
- return;
- }
- }
-}
-
-void FlightPathMovementGenerator::DoEventIfAny(Player* player, TaxiPathNodeEntry const* node, bool departure)
-{
- if (uint32 eventid = departure ? node->DepartureEventID : node->ArrivalEventID)
- {
- TC_LOG_DEBUG("maps.script", "Taxi %s event %u of node %u of path %u for player %s", departure ? "departure" : "arrival", eventid, node->NodeIndex, node->PathID, player->GetName().c_str());
- player->GetMap()->ScriptsStart(sEventScripts, eventid, player, player);
- }
-}
-
-bool FlightPathMovementGenerator::GetResetPos(Player*, float& x, float& y, float& z)
-{
- TaxiPathNodeEntry const* node = _path[_currentNode];
- x = node->Loc.X;
- y = node->Loc.Y;
- z = node->Loc.Z;
- return true;
-}
-
-void FlightPathMovementGenerator::InitEndGridInfo()
-{
- /*! Storage to preload flightmaster grid at end of flight. For multi-stop flights, this will
- be reinitialized for each flightmaster at the end of each spline (or stop) in the flight. */
- uint32 nodeCount = _path.size(); //! Number of nodes in path.
- _endMapId = _path[nodeCount - 1]->ContinentID; //! MapId of last node
- _preloadTargetNode = nodeCount - 3;
- _endGridX = _path[nodeCount - 1]->Loc.X;
- _endGridY = _path[nodeCount - 1]->Loc.Y;
-}
-
-void FlightPathMovementGenerator::PreloadEndGrid()
-{
- // used to preload the final grid where the flightmaster is
- Map* endMap = sMapMgr->FindBaseNonInstanceMap(_endMapId);
-
- // Load the grid
- if (endMap)
- {
- TC_LOG_DEBUG("misc", "Preloading rid (%f, %f) for map %u at node index %u/%u", _endGridX, _endGridY, _endMapId, _preloadTargetNode, (uint32)(_path.size() - 1));
- endMap->LoadGrid(_endGridX, _endGridY);
- }
- else
- TC_LOG_DEBUG("misc", "Unable to determine map to preload flightmaster grid");
-}
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
index 4c5d6cba197..d3f3cd664e3 100755
--- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
@@ -29,7 +29,6 @@
#include "Timer.h"
class Creature;
-class Player;
struct TaxiPathNodeEntry;
struct WaypointPath;
@@ -94,47 +93,4 @@ class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium<Creat
bool _done;
};
-/**
- * FlightPathMovementGenerator generates movement of the player for the paths
- * and hence generates ground and activities for the player.
- */
-class FlightPathMovementGenerator : public MovementGeneratorMedium<Player, FlightPathMovementGenerator>, public PathMovementBase<Player, std::vector<TaxiPathNodeEntry const*>>
-{
- public:
- explicit FlightPathMovementGenerator();
-
- void LoadPath(Player* player, uint32 startNode = 0);
- void DoInitialize(Player*);
- void DoReset(Player*);
- void DoFinalize(Player*);
- bool DoUpdate(Player*, uint32);
- MovementGeneratorType GetMovementGeneratorType() const override { return FLIGHT_MOTION_TYPE; }
-
- std::vector<TaxiPathNodeEntry const*> const& GetPath() { return _path; }
- uint32 GetPathAtMapEnd() const;
- bool HasArrived() const { return (_currentNode >= _path.size()); }
- void SetCurrentNodeAfterTeleport();
- void SkipCurrentNode() { ++_currentNode; }
- void DoEventIfAny(Player* player, TaxiPathNodeEntry const* node, bool departure);
-
- bool GetResetPos(Player*, float& x, float& y, float& z);
- void InitEndGridInfo();
- void PreloadEndGrid();
-
- private:
-
- float _endGridX; //! X coord of last node location
- float _endGridY; //! Y coord of last node location
- uint32 _endMapId; //! map Id of last node location
- uint32 _preloadTargetNode; //! node index where preloading starts
-
- struct TaxiNodeChangeInfo
- {
- uint32 PathIndex;
- int64 Cost;
- };
-
- std::deque<TaxiNodeChangeInfo> _pointsForPathSwitch; //! node indexes and costs where TaxiPath changes
-};
-
#endif