diff options
author | Matan Shukry <matanshukry@gmail.com> | 2021-04-26 22:39:22 +0300 |
---|---|---|
committer | jackpoz <giacomopoz@gmail.com> | 2021-06-06 18:04:43 +0200 |
commit | e6a36f058ec6b6be9e7097815e45d146836656ea (patch) | |
tree | 2a3cd57538e76c9440f2c6e85d301305ad2fd7b0 | |
parent | 9fe9dc087b4dc52af7897942a83c1f880d3a4ef8 (diff) |
Core/SAI: Don't clear stored pathid if it changed after processing waypoint events (#26334)
(cherry picked from commit 8b0de23d0e4b15fce8dc8c67f9512f76804d6439)
# Conflicts:
# src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartAI.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index e005396c3cf..628eee9f764 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -244,14 +244,15 @@ void SmartAI::EndPath(bool fail) if (fail) return; - GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, nullptr, _currentWaypointNode, GetScript()->GetPathId()); + uint32 pathid = GetScript()->GetPathId(); + GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, nullptr, _currentWaypointNode, pathid); if (_repeatWaypointPath) { if (IsAIControlled()) StartPath(_run, GetScript()->GetPathId(), _repeatWaypointPath); } - else + else if (pathid == GetScript()->GetPathId()) // if it's not the same pathid, our script wants to start another path; don't override it GetScript()->SetPathId(0); if (_despawnState == 1) |