diff options
| author | ModoX <moardox@gmail.com> | 2024-01-05 17:56:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-05 17:56:19 +0100 |
| commit | 12186ef8573f60abeff4747da58767ee71092600 (patch) | |
| tree | 7d9a1da93e86fa3ccd84c02658bface3ef536721 /src/server/game/AI/ScriptedAI | |
| parent | 390f0be9fb22766638006f43e4d0887108ba49e8 (diff) | |
Core/Waypoints: Refactor to split data into path and node related info in db (#29506)
Diffstat (limited to 'src/server/game/AI/ScriptedAI')
| -rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index ecc44114f85..ca6290d1379 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -141,13 +141,13 @@ void EscortAI::MovementInform(uint32 type, uint32 id) } else if (type == WAYPOINT_MOTION_TYPE) { - ASSERT(id < _path.nodes.size(), "EscortAI::MovementInform: referenced movement id (%u) points to non-existing node in loaded path (%s)", id, me->GetGUID().ToString().c_str()); - WaypointNode waypoint = _path.nodes[id]; + ASSERT(id < _path.Nodes.size(), "EscortAI::MovementInform: referenced movement id (%u) points to non-existing node in loaded path (%s)", id, me->GetGUID().ToString().c_str()); + WaypointNode waypoint = _path.Nodes[id]; - TC_LOG_DEBUG("scripts.ai.escortai", "EscortAI::MovementInform: waypoint node {} reached ({})", waypoint.id, me->GetGUID().ToString()); + TC_LOG_DEBUG("scripts.ai.escortai", "EscortAI::MovementInform: waypoint node {} reached ({})", waypoint.Id, me->GetGUID().ToString()); // last point - if (id == _path.nodes.size() - 1) + if (id == _path.Nodes.size() - 1) { _started = false; _ended = true; @@ -264,20 +264,14 @@ void EscortAI::AddWaypoint(uint32 id, float x, float y, float z, float orientati Trinity::NormalizeMapCoord(x); Trinity::NormalizeMapCoord(y); - WaypointNode waypoint; - waypoint.id = id; - waypoint.x = x; - waypoint.y = y; - waypoint.z = z; - waypoint.orientation = orientation; - waypoint.moveType = run ? WAYPOINT_MOVE_TYPE_RUN : WAYPOINT_MOVE_TYPE_WALK; - waypoint.delay = waitTime.count(); - _path.nodes.push_back(std::move(waypoint)); + WaypointNode waypoint(id, x, y, z, orientation, waitTime.count()); + waypoint.MoveType = run ? WaypointMoveType::Run : WaypointMoveType::Walk; + _path.Nodes.push_back(std::move(waypoint)); } void EscortAI::ResetPath() { - _path.nodes.clear(); + _path.Nodes.clear(); } void EscortAI::LoadPath(uint32 pathId) @@ -294,7 +288,7 @@ void EscortAI::LoadPath(uint32 pathId) /// @todo get rid of this many variables passed in function. void EscortAI::Start(bool isActiveAttacker /* = true*/, ObjectGuid playerGUID /* = 0 */, Quest const* quest /* = nullptr */, bool instantRespawn /* = false */, bool canLoopPath /* = false */) { - if (_path.nodes.empty()) + if (_path.Nodes.empty()) { TC_LOG_ERROR("scripts.ai.escortai", "EscortAI::Start: (script: {}) path is empty ({})", me->GetScriptName(), me->GetGUID().ToString()); return; @@ -319,7 +313,7 @@ void EscortAI::Start(bool isActiveAttacker /* = true*/, ObjectGuid playerGUID /* return; } - if (_path.nodes.empty()) + if (_path.Nodes.empty()) { TC_LOG_ERROR("scripts.ai.escortai", "EscortAI::Start: (script: {}) is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn ({})", me->GetScriptName(), me->GetGUID().ToString()); return; @@ -348,7 +342,7 @@ void EscortAI::Start(bool isActiveAttacker /* = true*/, ObjectGuid playerGUID /* } TC_LOG_DEBUG("scripts.ai.escortai", "EscortAI::Start: (script: {}) started with {} waypoints. ActiveAttacker = {}, Player = {} ({})", - me->GetScriptName(), uint32(_path.nodes.size()), _activeAttacker, _playerGUID.ToString(), me->GetGUID().ToString()); + me->GetScriptName(), uint32(_path.Nodes.size()), _activeAttacker, _playerGUID.ToString(), me->GetGUID().ToString()); _started = false; AddEscortState(STATE_ESCORT_ESCORTING); |
