chore: Remove dead SearchForBestPath function and MaxMovementSearchTime config

This commit is contained in:
bash 2026-05-08 12:33:54 +02:00
parent 840df97f9a
commit 6a396b0f86
5 changed files with 1 additions and 79 deletions

View File

@ -344,10 +344,6 @@ AiPlayerbot.MaxWaitForMove = 5000
# 2 - MoveSplinePath disabled everywhere
AiPlayerbot.DisableMoveSplinePath = 0
# Max search time for movement (higher for better movement on slopes)
# Default: 3
AiPlayerbot.MaxMovementSearchTime = 3
# Action expiration time
AiPlayerbot.ExpireActionTime = 5000

View File

@ -1893,75 +1893,6 @@ PathResult MovementAction::GeneratePath(float x, float y, float z, uint32 accept
return result;
}
const Movement::PointsArray MovementAction::SearchForBestPath(float x, float y, float z, float& modified_z,
int maxSearchCount, bool normal_only, float step)
{
bool found = false;
modified_z = INVALID_HEIGHT;
float tempZ = bot->GetMapHeight(x, y, z);
PathGenerator gen(bot);
gen.CalculatePath(x, y, tempZ);
Movement::PointsArray result = gen.GetPath();
float min_length = gen.getPathLength();
int typeOk = PATHFIND_NORMAL | PATHFIND_INCOMPLETE;
if ((gen.GetPathType() & typeOk) && abs(tempZ - z) < 0.5f)
{
modified_z = tempZ;
return result;
}
// Start searching
if (gen.GetPathType() & typeOk)
{
modified_z = tempZ;
found = true;
}
int count = 1;
for (float delta = step; count < maxSearchCount / 2 + 1; count++, delta += step)
{
tempZ = bot->GetMapHeight(x, y, z + delta);
if (tempZ == INVALID_HEIGHT)
{
continue;
}
PathGenerator gen(bot);
gen.CalculatePath(x, y, tempZ);
if ((gen.GetPathType() & typeOk) && gen.getPathLength() < min_length)
{
found = true;
min_length = gen.getPathLength();
result = gen.GetPath();
modified_z = tempZ;
}
}
for (float delta = -step; count < maxSearchCount; count++, delta -= step)
{
tempZ = bot->GetMapHeight(x, y, z + delta);
if (tempZ == INVALID_HEIGHT)
{
continue;
}
PathGenerator gen(bot);
gen.CalculatePath(x, y, tempZ);
if ((gen.GetPathType() & typeOk) && gen.getPathLength() < min_length)
{
found = true;
min_length = gen.getPathLength();
result = gen.GetPath();
modified_z = tempZ;
}
}
if (!found && normal_only)
{
modified_z = INVALID_HEIGHT;
return Movement::PointsArray{};
}
if (!found && !normal_only)
{
return result;
}
return result;
}
void MovementAction::DoMovePoint(Unit* unit, float x, float y, float z, bool generatePath, bool backwards)
{
if (!unit)

View File

@ -115,10 +115,6 @@ protected:
};
private:
// float SearchBestGroundZForPath(float x, float y, float z, bool generatePath, float range = 20.0f, bool
// normal_only = false, float step = 8.0f);
const Movement::PointsArray SearchForBestPath(float x, float y, float z, float& modified_z, int maxSearchCount = 5,
bool normal_only = false, float step = 8.0f);
bool wasMovementRestricted = false;
void DoMovePoint(Unit* unit, float x, float y, float z, bool generatePath, bool backwards);
};

View File

@ -72,7 +72,6 @@ bool PlayerbotAIConfig::Initialize()
globalCoolDown = sConfigMgr->GetOption<int32>("AiPlayerbot.GlobalCooldown", 500);
maxWaitForMove = sConfigMgr->GetOption<int32>("AiPlayerbot.MaxWaitForMove", 5000);
disableMoveSplinePath = sConfigMgr->GetOption<int32>("AiPlayerbot.DisableMoveSplinePath", 0);
maxMovementSearchTime = sConfigMgr->GetOption<int32>("AiPlayerbot.MaxMovementSearchTime", 3);
expireActionTime = sConfigMgr->GetOption<int32>("AiPlayerbot.ExpireActionTime", 5000);
dispelAuraDuration = sConfigMgr->GetOption<int32>("AiPlayerbot.DispelAuraDuration", 700);
reactDelay = sConfigMgr->GetOption<int32>("AiPlayerbot.ReactDelay", 100);

View File

@ -91,7 +91,7 @@ public:
bool EnableICCBuffs;
bool allowAccountBots, allowGuildBots, allowTrustedAccountBots;
bool randomBotGuildNearby, randomBotInvitePlayer, inviteChat;
uint32 globalCoolDown, reactDelay, maxWaitForMove, disableMoveSplinePath, maxMovementSearchTime, expireActionTime,
uint32 globalCoolDown, reactDelay, maxWaitForMove, disableMoveSplinePath, expireActionTime,
dispelAuraDuration, passiveDelay, repeatDelay, errorDelay, rpgDelay, sitDelay, returnDelay, lootDelay;
bool dynamicReactDelay;
float sightDistance, spellDistance, reactDistance, grindDistance, lootDistance, shootDistance, fleeDistance,