From 6021e397f5202d1f2abd81a3a32c7a80256ae48e Mon Sep 17 00:00:00 2001 From: bash Date: Fri, 8 May 2026 23:16:51 +0200 Subject: [PATCH] fix(Core/Travel): Drop stale TravelPlan when destination shifts --- src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp b/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp index 374ec1359..138b82830 100644 --- a/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp +++ b/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp @@ -164,9 +164,19 @@ bool NewRpgBaseAction::MoveFarTo(WorldPosition dest) // waypoint spline at dest. bool tryNodes = (dis >= nodeFirstDis && sPlayerbotAIConfig.enableTravelNodes); - // If a node plan is already active, ride it. + // If a node plan is already active, ride it — but only if its + // destination still matches the requested dest. Otherwise the + // old plan (e.g. built toward a quest objective POI) would keep + // driving the bot after the caller switched targets (e.g. to a + // turn-in NPC). cmangos's ResolveMovePath dodges this by being + // stateless; we have a long-lived plan flag, so check explicitly. if (tryNodes && botAI->rpgInfo.HasActiveTravelPlan()) - return UpdateTravelPlan(); + { + if (botAI->rpgInfo.travelPlan.destination.distance(dest) > 10.0f) + botAI->rpgInfo.ClearTravel(); + else + return UpdateTravelPlan(); + } // PRIORITY: try the travel-node graph FIRST when the move is // long enough to need it.