diff options
author | Shauren <shauren.trinity@gmail.com> | 2017-12-11 22:15:52 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2017-12-11 22:15:52 +0100 |
commit | e977bb4c4de3608cbbfe0b2d28cd0f4176a44777 (patch) | |
tree | 30b239933398749211c1802ef15fdbacaaaa761a /src | |
parent | 0db5516a1a8edcb0bcac86bc1ba5354abe267097 (diff) |
Core/Misc: Fixed nopch MSVC build
Diffstat (limited to 'src')
6 files changed, 310 insertions, 264 deletions
diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp index 6adc2d04aed..44f50609812 100644 --- a/src/server/game/Handlers/TaxiHandler.cpp +++ b/src/server/game/Handlers/TaxiHandler.cpp @@ -21,13 +21,13 @@ #include "Creature.h" #include "DatabaseEnv.h" #include "DBCStores.h" +#include "FlightPathMovementGenerator.h" #include "Log.h" #include "MotionMaster.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Opcodes.h" #include "Player.h" -#include "WaypointMovementGenerator.h" #include "WorldPacket.h" void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvData) diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 3f77e472189..ec55f90cbd2 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -22,6 +22,7 @@ #include "CreatureAISelector.h" #include "DBCStores.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..cfcf44ad136 --- /dev/null +++ b/src/server/game/Movement/MovementGenerators/FlightPathMovementGenerator.cpp @@ -0,0 +1,239 @@ +/* + * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/> + * + * 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 "DBCStores.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(uint32 startNode) +{ + _currentNode = startNode; + _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]->MapID; + for (uint32 itr = _currentNode; itr < _path.size(); ++itr) + if (_path[itr]->MapID != curMapId) + return itr; + + return _path.size(); +} + +bool IsNodeIncludedInShortenedPath(TaxiPathNodeEntry const* p1, TaxiPathNodeEntry const* p2) +{ + return p1->MapID != p2->MapID || std::pow(p1->LocX - p2->LocX, 2) + std::pow(p1->LocY - p2->LocY, 2) > SKIP_SPLINE_POINT_DISTANCE_SQ; +} + +void FlightPathMovementGenerator::LoadPath(Player* player) +{ + _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[_path.size() - 1], 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), int32(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->RemoveFlag(UNIT_FIELD_FLAGS, 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->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK); +} + +void FlightPathMovementGenerator::DoReset(Player* player) +{ + player->getHostileRefManager().setOnlineOfflineState(false); + player->AddUnitState(UNIT_STATE_IN_FLIGHT); + player->SetFlag(UNIT_FIELD_FLAGS, 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]->LocX, _path[i]->LocY, _path[i]->LocZ); + init.Path().push_back(vertice); + } + init.SetFirstPointId(GetCurrentNode()); + init.SetFly(); + 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->UpdateAchievementCriteria(ACHIEVEMENT_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]->MapID; + for (size_t i = _currentNode + 1; i < _path.size(); ++i) + { + if (_path[i]->MapID != 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->LocX; + y = node->LocY; + z = node->LocZ; + 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]->MapID; //! MapId of last node + _preloadTargetNode = nodeCount - 3; + _endGridX = _path[nodeCount - 1]->LocX; + _endGridY = _path[nodeCount - 1]->LocY; +} + +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..ba195753200 --- /dev/null +++ b/src/server/game/Movement/MovementGenerators/FlightPathMovementGenerator.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/> + * + * 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, TaxiPathNodeList> +{ +public: + explicit FlightPathMovementGenerator(uint32 startNode = 0); + + void LoadPath(Player* player); + void DoInitialize(Player*); + void DoReset(Player*); + void DoFinalize(Player*); + bool DoUpdate(Player*, uint32); + MovementGeneratorType GetMovementGeneratorType() const override { return FLIGHT_MOTION_TYPE; } + + TaxiPathNodeList 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; + int32 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 74a8588163c..230339992c3 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -20,15 +20,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) @@ -323,218 +320,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(uint32 startNode) -{ - _currentNode = startNode; - _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]->MapID; - for (uint32 itr = _currentNode; itr < _path.size(); ++itr) - if (_path[itr]->MapID != curMapId) - return itr; - - return _path.size(); -} - -bool IsNodeIncludedInShortenedPath(TaxiPathNodeEntry const* p1, TaxiPathNodeEntry const* p2) -{ - return p1->MapID != p2->MapID || std::pow(p1->LocX - p2->LocX, 2) + std::pow(p1->LocY - p2->LocY, 2) > SKIP_SPLINE_POINT_DISTANCE_SQ; -} - -void FlightPathMovementGenerator::LoadPath(Player* player) -{ - _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[_path.size() - 1], 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), int32(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->RemoveFlag(UNIT_FIELD_FLAGS, 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->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK); -} - -void FlightPathMovementGenerator::DoReset(Player* player) -{ - player->getHostileRefManager().setOnlineOfflineState(false); - player->AddUnitState(UNIT_STATE_IN_FLIGHT); - player->SetFlag(UNIT_FIELD_FLAGS, 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]->LocX, _path[i]->LocY, _path[i]->LocZ); - init.Path().push_back(vertice); - } - init.SetFirstPointId(GetCurrentNode()); - init.SetFly(); - 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->UpdateAchievementCriteria(ACHIEVEMENT_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]->MapID; - for (size_t i = _currentNode + 1; i < _path.size(); ++i) - { - if (_path[i]->MapID != 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->LocX; - y = node->LocY; - z = node->LocZ; - 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]->MapID; //! MapId of last node - _preloadTargetNode = nodeCount - 3; - _endGridX = _path[nodeCount - 1]->LocX; - _endGridY = _path[nodeCount - 1]->LocY; -} - -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 e447bad7bb8..999ef8fa444 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h @@ -31,7 +31,6 @@ #include "Timer.h" class Creature; -class Player; struct WaypointPath; template<class Entity, class BasePath> @@ -95,47 +94,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, TaxiPathNodeList> -{ - public: - explicit FlightPathMovementGenerator(uint32 startNode = 0); - - void LoadPath(Player* player); - void DoInitialize(Player*); - void DoReset(Player*); - void DoFinalize(Player*); - bool DoUpdate(Player*, uint32); - MovementGeneratorType GetMovementGeneratorType() const override { return FLIGHT_MOTION_TYPE; } - - TaxiPathNodeList 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; - int32 Cost; - }; - - std::deque<TaxiNodeChangeInfo> _pointsForPathSwitch; //! node indexes and costs where TaxiPath changes -}; - #endif |