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
committerfunjoker <funjoker109@gmail.com>2021-01-29 19:23:53 +0100
commitbf12bae46746149d870cd3e52ccd610f0a975047 (patch)
tree57b5f138b6d5dbefa8ec96aa14dbba150a1d0979 /src/server/game/Movement/MotionMaster.cpp
parent69d6b4241d8d9c49c135aec3a50fdafcca250a5f (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 (cherry picked from commit e10d7dd45cfc073c791cd5e5f3f964d14b37df3d)
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 07623c3a261..b3d0e45339b 100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -153,17 +153,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];
}