aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Movement/MotionMaster.cpp
diff options
context:
space:
mode:
authorccrs <ccrs@users.noreply.github.com>2017-11-06 22:19:23 +0100
committerccrs <ccrs@users.noreply.github.com>2017-11-06 22:19:23 +0100
commite10d7dd45cfc073c791cd5e5f3f964d14b37df3d (patch)
tree04f695772c2b253fbde2fde6511465b776e1e104 /src/server/game/Movement/MotionMaster.cpp
parentd7de84b0277699fa12776864906e393f414aee08 (diff)
Core/Misc: waypoint movement
- Creature: update current waypoint to store nodeId and pathId - MotionMaster: change variable type on GetMotionSlotType and GetMotionSlot to keep consistency and prevent errors (ASSERT is now no longer needed) - UnitAI: add new waypoint hooks WaypointPathStarted and WaypointPathEnded - SAI: handle WAYPOINT related events if creature is no escorting * SMART_EVENT_WAYPOINT_RESUMED still not implemented for no escorting TODO: the new hooks can save, now duplicated, logic on EscortAI and SAI closes #20777 updates #20310 updates 21bd52cb99
Diffstat (limited to 'src/server/game/Movement/MotionMaster.cpp')
-rw-r--r--src/server/game/Movement/MotionMaster.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp
index b2027144487..3f77e472189 100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -155,17 +155,19 @@ MovementGeneratorType MotionMaster::GetCurrentMovementGeneratorType() const
return top()->GetMovementGeneratorType();
}
-MovementGeneratorType MotionMaster::GetMotionSlotType(int slot) const
+MovementGeneratorType MotionMaster::GetMotionSlotType(MovementSlot slot) const
{
- if (!_slot[slot])
+ if (empty() || slot >= MAX_MOTION_SLOT || !_slot[slot])
return MAX_MOTION_TYPE;
- else
- return _slot[slot]->GetMovementGeneratorType();
+
+ return _slot[slot]->GetMovementGeneratorType();
}
-MovementGenerator* MotionMaster::GetMotionSlot(int slot) const
+MovementGenerator* MotionMaster::GetMotionSlot(MovementSlot slot) const
{
- ASSERT(slot >= 0);
+ if (empty() || slot >= MAX_MOTION_SLOT || !_slot[slot])
+ return nullptr;
+
return _slot[slot];
}