aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Movement/MotionMaster.cpp
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2017-06-19 23:20:06 -0300
committerariel- <ariel-@users.noreply.github.com>2017-06-19 23:20:06 -0300
commit85a7d5ce9ac68b30da2277cc91d4b70358f1880d (patch)
treedf3d2084ee2e35008903c03178039b9c986e2d08 /src/server/game/Movement/MotionMaster.cpp
parent052fc24315ace866ea1cf610e85df119b68100c9 (diff)
Core: ported headers cleanup from master branch
Diffstat (limited to 'src/server/game/Movement/MotionMaster.cpp')
-rw-r--r--src/server/game/Movement/MotionMaster.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp
index 6f4c198f44d..6e771a29979 100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -17,8 +17,12 @@
*/
#include "MotionMaster.h"
-#include "CreatureAISelector.h"
#include "Creature.h"
+#include "CreatureAISelector.h"
+#include "DBCStores.h"
+#include "Log.h"
+#include "Map.h"
+#include "PathGenerator.h"
#include "ScriptSystem.h"
#include "ConfusedMovementGenerator.h"
#include "FleeingMovementGenerator.h"
@@ -510,15 +514,16 @@ 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)
-{
- Movement::PointsArray path(pathPoints, pathPoints + pathSize);
- MoveSmoothPath(pointId, path, walk);
-}
-
-void MotionMaster::MoveSmoothPath(uint32 pointId, Movement::PointsArray const& path, bool walk)
+void MotionMaster::MoveSmoothPath(uint32 pointId, Position const* pathPoints, size_t pathSize, bool walk)
{
Movement::MoveSplineInit init(_owner);
+ 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);
@@ -540,7 +545,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<SplineChainLink> 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);
@@ -549,7 +554,7 @@ void MotionMaster::MoveAlongSplineChain(uint32 pointId, uint16 dbChainId, bool w
MoveAlongSplineChain(pointId, *chain, walk);
}
-void MotionMaster::MoveAlongSplineChain(uint32 pointId, SplineChain const& chain, bool walk)
+void MotionMaster::MoveAlongSplineChain(uint32 pointId, std::vector<SplineChainLink> const& chain, bool walk)
{
Mutate(new SplineChainMovementGenerator(pointId, chain, walk), MOTION_SLOT_ACTIVE);
}