aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/ScriptedAI
diff options
context:
space:
mode:
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);