aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/ScriptedAI
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2024-04-19 15:16:17 +0200
committerShauren <shauren.trinity@gmail.com>2024-04-19 15:16:17 +0200
commite1f43900d110e50a2021d605c61cfe7c436bcc54 (patch)
tree6c79a4d74f8c91eb1e3683f5bdc77d13d30662bf /src/server/game/AI/ScriptedAI
parentff9db332f5436fca0a9b14c15951cd8454ecdfb0 (diff)
Core/Movement: Store delay in WaypointNode as Milliseconds instead of raw integer and revert c5097114d1d08d6d6f7d2adc9f5f3f52f75c5818
Diffstat (limited to 'src/server/game/AI/ScriptedAI')
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp7
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.h2
2 files changed, 4 insertions, 5 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index 19d11c4b957..1754fa6dfd5 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -253,17 +253,16 @@ void EscortAI::UpdateEscortAI(uint32 /*diff*/)
void EscortAI::AddWaypoint(uint32 id, float x, float y, float z, bool run)
{
- AddWaypoint(id, x, y, z, 0.0f, 0s, run);
+ AddWaypoint(id, x, y, z, 0.0f, {}, run);
}
-void EscortAI::AddWaypoint(uint32 id, float x, float y, float z, float orientation/* = 0*/, Milliseconds waitTime/* = 0s*/, bool run /*= false*/)
+void EscortAI::AddWaypoint(uint32 id, float x, float y, float z, float orientation/* = 0*/, Optional<Milliseconds> waitTime/* = {}*/, bool run /*= false*/)
{
Trinity::NormalizeMapCoord(x);
Trinity::NormalizeMapCoord(y);
- WaypointNode waypoint(id, x, y, z, orientation, waitTime.count());
+ WaypointNode& waypoint = _path.Nodes.emplace_back(id, x, y, z, orientation, waitTime);
waypoint.MoveType = run ? WaypointMoveType::Run : WaypointMoveType::Walk;
- _path.Nodes.push_back(std::move(waypoint));
}
void EscortAI::ResetPath()
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
index 0108a7a8c21..85f50f83206 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
@@ -49,7 +49,7 @@ struct TC_GAME_API EscortAI : public ScriptedAI
virtual void UpdateEscortAI(uint32 diff); // used when it's needed to add code in update (abilities, scripted events, etc)
void AddWaypoint(uint32 id, float x, float y, float z, bool run);
- void AddWaypoint(uint32 id, float x, float y, float z, float orientation = 0.f, Milliseconds waitTime = 0s, bool run = false);
+ void AddWaypoint(uint32 id, float x, float y, float z, float orientation = 0.f, Optional<Milliseconds> waitTime = {}, bool run = false);
void ResetPath();
void LoadPath(uint32 pathId);
void Start(bool isActiveAttacker = true, ObjectGuid playerGUID = ObjectGuid::Empty, Quest const* quest = nullptr, bool instantRespawn = false, bool canLoopPath = false);