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 b3694bf47b)
This commit is contained in:
jackpoz
2020-09-06 17:35:26 +02:00
committed by Shauren
parent e0e3bae82c
commit c2d2df96db
2 changed files with 5 additions and 12 deletions

View File

@@ -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)

View File

@@ -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: