From b453e124231a90321fe79fbf3a62acdcfa54a691 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 4 Jun 2017 01:00:45 +0200 Subject: Core/Game: Include cleanup part 5 * ObjectMgr.h * Player.h * Unit.h * G3D should no longer propagate everywhere from Spline/MotionMaster --- src/server/game/Movement/MotionMaster.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/server/game/Movement/MotionMaster.cpp') diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 9618146160e..6d60c96d72a 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -21,6 +21,7 @@ #include "Creature.h" #include "ScriptSystem.h" #include "Log.h" +#include "Map.h" #include "ConfusedMovementGenerator.h" #include "FleeingMovementGenerator.h" #include "HomeMovementGenerator.h" @@ -457,7 +458,7 @@ void MotionMaster::MoveCirclePath(float x, float y, float z, float radius, bool init.Launch(); } -void MotionMaster::MoveSmoothPath(uint32 pointId, G3D::Vector3 const* pathPoints, size_t pathSize, bool walk, bool fly) +void MotionMaster::MoveSmoothPath(uint32 pointId, Position const* pathPoints, size_t pathSize, bool walk, bool fly) { Movement::MoveSplineInit init(_owner); if (fly) @@ -466,7 +467,12 @@ void MotionMaster::MoveSmoothPath(uint32 pointId, G3D::Vector3 const* pathPoints init.SetUncompressed(); } - Movement::PointsArray path(pathPoints, pathPoints + pathSize); + Movement::PointsArray path; + path.reserve(pathSize); + std::transform(pathPoints, pathPoints + pathSize, std::back_inserter(path), [](Position const& point) + { + return G3D::Vector3(point.GetPositionX(), point.GetPositionY(), point.GetPositionZ()); + }); init.MovebyPath(path); init.SetSmooth(); init.SetWalk(walk); @@ -488,7 +494,7 @@ void MotionMaster::MoveAlongSplineChain(uint32 pointId, uint16 dbChainId, bool w TC_LOG_ERROR("misc", "MotionMaster::MoveAlongSplineChain: non-creature %s tried to walk along DB spline chain. Ignoring.", _owner->GetGUID().ToString().c_str()); return; } - SplineChain const* chain = sScriptSystemMgr->GetSplineChain(owner, dbChainId); + std::vector const* chain = sScriptSystemMgr->GetSplineChain(owner, dbChainId); if (!chain) { TC_LOG_ERROR("misc", "MotionMaster::MoveAlongSplineChain: creature with entry %u tried to walk along non-existing spline chain with DB id %u.", owner->GetEntry(), dbChainId); -- cgit v1.2.3