diff options
author | jackpoz <giacomopoz@gmail.com> | 2020-09-06 17:35:26 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-02-05 13:31:00 +0100 |
commit | c2d2df96dbe8e31e27283f73bad576ab42a3d579 (patch) | |
tree | 1d1d9a63ab3db3c43c35ddf847849c9cf374233f | |
parent | e0e3bae82cfb6c70ba810997104054ab6ca77e99 (diff) |
Core/SAI: Fix SMART_EVENT_WAYPOINT_START not being called at every waypoint checking wrong path id parameter
Remove multiple calls to SMART_EVENT_WAYPOINT_START for the 1st waypoint.
Closes #24760
(cherry picked from commit b3694bf47bfdab8ee9c074ac4a22d8f389e1cfc1)
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartAI.cpp | 13 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 4 |
2 files changed, 5 insertions, 12 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 3e58a5ec3eb..e4a4d953535 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -73,8 +73,6 @@ void SmartAI::StartPath(bool run/* = false*/, uint32 pathId/* = 0*/, bool repeat me->SetNpcFlags((NPCFlags)0); } - GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_START, nullptr, _currentWaypointNode, GetScript()->GetPathId()); - me->GetMotionMaster()->MovePath(_path, _repeatWaypointPath); } @@ -347,17 +345,12 @@ bool SmartAI::IsEscortInvokerInRange() ///@todo move escort related logic void SmartAI::WaypointPathStarted(uint32 pathId) { - if (!HasEscortState(SMART_ESCORT_ESCORTING)) - { - // @todo remove the constant 1 at some point, it's never anything different - GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_START, nullptr, 1, pathId); - return; - } + // SmartAI::WaypointStarted() already handles the case of starting the 1st waypoint } -///@todo Implement new smart event SMART_EVENT_WAYPOINT_STARTED -void SmartAI::WaypointStarted(uint32 /*nodeId*/, uint32 /*pathId*/) +void SmartAI::WaypointStarted(uint32 nodeId, uint32 pathId) { + GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_START, nullptr, nodeId, pathId); } void SmartAI::WaypointReached(uint32 nodeId, uint32 pathId) diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index b17a06cab2b..e613b418bfb 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -3474,13 +3474,13 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui break; } case SMART_EVENT_TRANSPORT_RELOCATE: - case SMART_EVENT_WAYPOINT_START: { - if (e.event.waypoint.pathID && var0 != e.event.waypoint.pathID) + if (e.event.transportRelocate.pointID && var0 != e.event.transportRelocate.pointID) return; ProcessAction(e, unit, var0); break; } + case SMART_EVENT_WAYPOINT_START: case SMART_EVENT_WAYPOINT_REACHED: case SMART_EVENT_WAYPOINT_RESUMED: case SMART_EVENT_WAYPOINT_PAUSED: |