From de64d9780c58eb7f45dae995ed999888cfb3d7f4 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 363181ee8..3e7a660c0 100644 --- a/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp +++ b/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp @@ -163,9 +163,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.