mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
refactor(Core/Movement): Drop redundant bot filter setters at PathGenerator sites
This commit is contained in:
parent
a6d691e6a7
commit
f5cd75e336
@ -4292,8 +4292,6 @@ bool ArenaTactics::Execute(Event /*event*/)
|
|||||||
if (losBlocked)
|
if (losBlocked)
|
||||||
{
|
{
|
||||||
PathGenerator path(bot);
|
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);
|
path.CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), false);
|
||||||
|
|
||||||
if (path.GetPathType() != PATHFIND_NOPATH)
|
if (path.GetPathType() != PATHFIND_NOPATH)
|
||||||
|
|||||||
@ -124,9 +124,6 @@ bool GoAction::Execute(Event event)
|
|||||||
if (botAI->HasStrategy("debug move", BOT_STATE_NON_COMBAT))
|
if (botAI->HasStrategy("debug move", BOT_STATE_NON_COMBAT))
|
||||||
{
|
{
|
||||||
PathGenerator path(bot);
|
PathGenerator path(bot);
|
||||||
path.SetExcludeFlags(path.GetExcludeFlags() | NAV_GROUND_STEEP);
|
|
||||||
path.SetNavTerrainCost(NAV_WATER, 10.0f);
|
|
||||||
|
|
||||||
path.CalculatePath(x, y, z, false);
|
path.CalculatePath(x, y, z, false);
|
||||||
|
|
||||||
Movement::Vector3 end = path.GetEndPosition();
|
Movement::Vector3 end = path.GetEndPosition();
|
||||||
|
|||||||
@ -971,8 +971,6 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
PathGenerator path(bot);
|
PathGenerator path(bot);
|
||||||
path.SetExcludeFlags(path.GetExcludeFlags() | NAV_GROUND_STEEP);
|
|
||||||
path.SetNavTerrainCost(NAV_WATER, 10.0f);
|
|
||||||
path.CalculatePath(tx, ty, tz, false);
|
path.CalculatePath(tx, ty, tz, false);
|
||||||
PathType type = path.GetPathType();
|
PathType type = path.GetPathType();
|
||||||
int typeOk = PATHFIND_NORMAL | PATHFIND_INCOMPLETE | PATHFIND_SHORTCUT;
|
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;
|
PathResult result;
|
||||||
PathGenerator gen(bot);
|
PathGenerator gen(bot);
|
||||||
gen.SetExcludeFlags(gen.GetExcludeFlags() | NAV_GROUND_STEEP);
|
|
||||||
gen.SetNavTerrainCost(NAV_WATER, 10.0f);
|
|
||||||
gen.CalculatePath(x, y, z, forceDestination);
|
gen.CalculatePath(x, y, z, forceDestination);
|
||||||
result.pathType = gen.GetPathType();
|
result.pathType = gen.GetPathType();
|
||||||
result.reachable = !(result.pathType & (~acceptMask));
|
result.reachable = !(result.pathType & (~acceptMask));
|
||||||
|
|||||||
@ -719,14 +719,10 @@ std::vector<WorldPosition> WorldPosition::getPathStepFrom(WorldPosition startPos
|
|||||||
}
|
}
|
||||||
|
|
||||||
PathGenerator path(pathUnit);
|
PathGenerator path(pathUnit);
|
||||||
// Apply bot-style filter even when source is a temp Creature so
|
// Source is a temp Creature, so CreateFilter's bot block doesn't
|
||||||
// generation-time paths match what bots can actually walk at
|
// fire — apply the same bot rules here so generated paths match
|
||||||
// runtime. Without this, the temp-Creature branch of CreateFilter
|
// what bots can actually walk at runtime.
|
||||||
// leaves NAV_GROUND_STEEP included → generator produces walk
|
path.SetExcludeFlags(NAV_GROUND_STEEP);
|
||||||
// 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.
|
|
||||||
path.SetNavTerrainCost(NAV_WATER, 10.0f);
|
path.SetNavTerrainCost(NAV_WATER, 10.0f);
|
||||||
auto result = getPathStepFrom(startPos, path);
|
auto result = getPathStepFrom(startPos, path);
|
||||||
|
|
||||||
@ -860,12 +856,9 @@ std::vector<WorldPosition> WorldPosition::getPathFromPath(std::vector<WorldPosit
|
|||||||
}
|
}
|
||||||
|
|
||||||
PathGenerator path(pathUnit);
|
PathGenerator path(pathUnit);
|
||||||
// Same reason as in getPathStepFrom: ensure NAV_GROUND_STEEP is
|
// Same reason as getPathStepFrom: temp-Creature source doesn't trip
|
||||||
// excluded for the temp-Creature path so generation matches
|
// CreateFilter's bot block, so apply the bot rules manually.
|
||||||
// runtime bot filter.
|
path.SetExcludeFlags(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.SetNavTerrainCost(NAV_WATER, 10.0f);
|
path.SetNavTerrainCost(NAV_WATER, 10.0f);
|
||||||
|
|
||||||
// Limit the pathfinding attempts
|
// Limit the pathfinding attempts
|
||||||
|
|||||||
@ -1252,8 +1252,6 @@ TravelNodeRoute TravelNodeMap::FindRouteNearestNodes(WorldPosition startPos, Wor
|
|||||||
if (startNodePosition.GetMapId() == bot->GetMapId())
|
if (startNodePosition.GetMapId() == bot->GetMapId())
|
||||||
{
|
{
|
||||||
PathGenerator path(bot);
|
PathGenerator path(bot);
|
||||||
path.SetExcludeFlags(path.GetExcludeFlags() | NAV_GROUND_STEEP);
|
|
||||||
path.SetNavTerrainCost(NAV_WATER, 10.0f);
|
|
||||||
path.CalculatePath(startNodePosition.GetPositionX(), startNodePosition.GetPositionY(), startNodePosition.GetPositionZ());
|
path.CalculatePath(startNodePosition.GetPositionX(), startNodePosition.GetPositionY(), startNodePosition.GetPositionZ());
|
||||||
PathType type = path.GetPathType();
|
PathType type = path.GetPathType();
|
||||||
bool reachable = !(type & ~(PATHFIND_NORMAL | PATHFIND_INCOMPLETE | PATHFIND_FARFROMPOLY));
|
bool reachable = !(type & ~(PATHFIND_NORMAL | PATHFIND_INCOMPLETE | PATHFIND_FARFROMPOLY));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user