fix(Core/Travel): Apply NAV_WATER cost bias on regen PathGenerator

This commit is contained in:
bash 2026-05-29 15:11:42 +02:00
parent 326f962bd7
commit 9d3ecbab88

View File

@ -725,6 +725,9 @@ std::vector<WorldPosition> WorldPosition::getPathStepFrom(WorldPosition startPos
// leaves NAV_GROUND_STEEP included → generator produces walk // leaves NAV_GROUND_STEEP included → generator produces walk
// segments through 50-60° slopes that runtime bots can't traverse. // segments through 50-60° slopes that runtime bots can't traverse.
path.SetExcludeFlags(path.GetExcludeFlags() | NAV_GROUND_STEEP); path.SetExcludeFlags(path.GetExcludeFlags() | NAV_GROUND_STEEP);
// Bias against water polys so A* prefers shore routes. Matches the
// runtime bot-Player filter setup in CreateFilter.
path.SetAreaCost(NAV_WATER, 10.0f);
auto result = getPathStepFrom(startPos, path); auto result = getPathStepFrom(startPos, path);
if (tempCreature) if (tempCreature)
@ -861,6 +864,9 @@ std::vector<WorldPosition> WorldPosition::getPathFromPath(std::vector<WorldPosit
// excluded for the temp-Creature path so generation matches // excluded for the temp-Creature path so generation matches
// runtime bot filter. // runtime bot filter.
path.SetExcludeFlags(path.GetExcludeFlags() | NAV_GROUND_STEEP); path.SetExcludeFlags(path.GetExcludeFlags() | NAV_GROUND_STEEP);
// Bias against water polys so A* prefers shore routes (matches the
// runtime bot filter set up in CreateFilter for Player bots).
path.SetAreaCost(NAV_WATER, 10.0f);
// Limit the pathfinding attempts // Limit the pathfinding attempts
for (uint32 i = 0; i < maxAttempt; i++) for (uint32 i = 0; i < maxAttempt; i++)