aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInit.cpp6
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInit.h28
-rwxr-xr-xsrc/server/game/World/World.cpp1
3 files changed, 24 insertions, 11 deletions
diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp
index e586cb4f4f9..924db9ad726 100644
--- a/src/server/game/Movement/Spline/MoveSplineInit.cpp
+++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp
@@ -54,7 +54,7 @@ namespace Movement
return MOVE_RUN;
}
- void MoveSplineInit::Launch()
+ int32 MoveSplineInit::Launch()
{
MoveSpline& move_spline = *unit.movespline;
@@ -86,7 +86,7 @@ namespace Movement
args.velocity = unit.GetSpeed(SelectSpeedType(moveFlags));
if (!args.Validate())
- return;
+ return 0;
if (moveFlags & MOVEMENTFLAG_ROOT)
moveFlags &= ~MOVEMENTFLAG_MASK_MOVING;
@@ -98,6 +98,8 @@ namespace Movement
data.append(unit.GetPackGUID());
PacketBuilder::WriteMonsterMove(move_spline, data);
unit.SendMessageToSet(&data,true);
+
+ return move_spline.Duration();
}
MoveSplineInit::MoveSplineInit(Unit& m) : unit(m)
diff --git a/src/server/game/Movement/Spline/MoveSplineInit.h b/src/server/game/Movement/Spline/MoveSplineInit.h
index 7ef6cd7a120..24563f28c4f 100644
--- a/src/server/game/Movement/Spline/MoveSplineInit.h
+++ b/src/server/game/Movement/Spline/MoveSplineInit.h
@@ -20,6 +20,7 @@
#define TRINITYSERVER_MOVESPLINEINIT_H
#include "MoveSplineInitArgs.h"
+#include "PathFinderMovementGenerator.h"
class Unit;
@@ -43,7 +44,7 @@ namespace Movement
/* Final pass of initialization that launches spline movement.
*/
- void Launch();
+ int32 Launch();
/* Adds movement by parabolic trajectory
* @param amplitude - the maximum height of parabola, value could be negative and positive
@@ -72,8 +73,8 @@ namespace Movement
/* Initializes simple A to B mition, A is current unit's position, B is destination
*/
- void MoveTo(const Vector3& destination);
- void MoveTo(float x, float y, float z);
+ void MoveTo(const Vector3& destination, bool generatePath = false, bool forceDestination = false);
+ void MoveTo(float x, float y, float z, bool generatePath = false, bool forceDestination = false);
/* Sets Id of fisrt point of the path. When N-th path point will be done ILisener will notify that pointId + N done
* Needed for waypoint movement where path splitten into parts
@@ -133,17 +134,26 @@ namespace Movement
args.path.assign(controls.begin(),controls.end());
}
- inline void MoveSplineInit::MoveTo(float x, float y, float z)
+ inline void MoveSplineInit::MoveTo(float x, float y, float z, bool generatePath, bool forceDestination)
{
Vector3 v(x,y,z);
- MoveTo(v);
+ MoveTo(v, generatePath, forceDestination);
}
- inline void MoveSplineInit::MoveTo(const Vector3& dest)
+ inline void MoveSplineInit::MoveTo(const Vector3& dest, bool generatePath, bool forceDestination)
{
- args.path_Idx_offset = 0;
- args.path.resize(2);
- args.path[1] = dest;
+ if (generatePath)
+ {
+ PathFinderMovementGenerator path(&unit);
+ path.calculate(dest.x, dest.y, dest.z, forceDestination);
+ MovebyPath(path.getPath());
+ }
+ else
+ {
+ args.path_Idx_offset = 0;
+ args.path.resize(2);
+ args.path[1] = dest;
+ }
}
inline void MoveSplineInit::SetParabolic(float amplitude, float time_shift)
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 3870a108d57..90d4ce3604a 100755
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -136,6 +136,7 @@ World::~World()
delete command;
VMAP::VMapFactory::clear();
+ MMAP::MMapFactory::clear();
//TODO free addSessQueue
}