refactor(Core/Movement): Drop redundant bot filter setters at PathGenerator sites

This commit is contained in:
bash 2026-05-29 20:04:39 +02:00
parent 82ebaa9594
commit 5f61fe9ddf
5 changed files with 7 additions and 25 deletions

View File

@ -4292,8 +4292,6 @@ bool ArenaTactics::Execute(Event /*event*/)
if (losBlocked)
{
PathGenerator path(bot);
path.SetExcludeFlags(path.GetExcludeFlags() | NAV_GROUND_STEEP);
path.SetNavTerrainCost(NAV_WATER, 10.0f);
path.CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), false);
if (path.GetPathType() != PATHFIND_NOPATH)

View File

@ -124,9 +124,6 @@ bool GoAction::Execute(Event event)
if (botAI->HasStrategy("debug move", BOT_STATE_NON_COMBAT))
{
PathGenerator path(bot);
path.SetExcludeFlags(path.GetExcludeFlags() | NAV_GROUND_STEEP);
path.SetNavTerrainCost(NAV_WATER, 10.0f);
path.CalculatePath(x, y, z, false);
Movement::Vector3 end = path.GetEndPosition();

View File

@ -971,8 +971,6 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance)
return false;
PathGenerator path(bot);
path.SetExcludeFlags(path.GetExcludeFlags() | NAV_GROUND_STEEP);
path.SetNavTerrainCost(NAV_WATER, 10.0f);
path.CalculatePath(tx, ty, tz, false);
PathType type = path.GetPathType();
int typeOk = PATHFIND_NORMAL | PATHFIND_INCOMPLETE | PATHFIND_SHORTCUT;
@ -1880,8 +1878,6 @@ PathResult MovementAction::GeneratePath(float x, float y, float z, uint32 accept
{
PathResult result;
PathGenerator gen(bot);
gen.SetExcludeFlags(gen.GetExcludeFlags() | NAV_GROUND_STEEP);
gen.SetNavTerrainCost(NAV_WATER, 10.0f);
gen.CalculatePath(x, y, z, forceDestination);
result.pathType = gen.GetPathType();
result.reachable = !(result.pathType & (~acceptMask));

View File

@ -719,14 +719,10 @@ std::vector<WorldPosition> WorldPosition::getPathStepFrom(WorldPosition startPos
}
PathGenerator path(pathUnit);
// Apply bot-style filter even when source is a temp Creature so
// generation-time paths match what bots can actually walk at
// runtime. Without this, the temp-Creature branch of CreateFilter
// leaves NAV_GROUND_STEEP included → generator produces walk
// segments through 50-60° slopes that runtime bots can't traverse.
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.
// Source is a temp Creature, so CreateFilter's bot block doesn't
// fire — apply the same bot rules here so generated paths match
// what bots can actually walk at runtime.
path.SetExcludeFlags(NAV_GROUND_STEEP);
path.SetNavTerrainCost(NAV_WATER, 10.0f);
auto result = getPathStepFrom(startPos, path);
@ -860,12 +856,9 @@ std::vector<WorldPosition> WorldPosition::getPathFromPath(std::vector<WorldPosit
}
PathGenerator path(pathUnit);
// Same reason as in getPathStepFrom: ensure NAV_GROUND_STEEP is
// excluded for the temp-Creature path so generation matches
// runtime bot filter.
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).
// Same reason as getPathStepFrom: temp-Creature source doesn't trip
// CreateFilter's bot block, so apply the bot rules manually.
path.SetExcludeFlags(NAV_GROUND_STEEP);
path.SetNavTerrainCost(NAV_WATER, 10.0f);
// Limit the pathfinding attempts

View File

@ -1252,8 +1252,6 @@ TravelNodeRoute TravelNodeMap::FindRouteNearestNodes(WorldPosition startPos, Wor
if (startNodePosition.GetMapId() == bot->GetMapId())
{
PathGenerator path(bot);
path.SetExcludeFlags(path.GetExcludeFlags() | NAV_GROUND_STEEP);
path.SetNavTerrainCost(NAV_WATER, 10.0f);
path.CalculatePath(startNodePosition.GetPositionX(), startNodePosition.GetPositionY(), startNodePosition.GetPositionZ());
PathType type = path.GetPathType();
bool reachable = !(type & ~(PATHFIND_NORMAL | PATHFIND_INCOMPLETE | PATHFIND_FARFROMPOLY));