From 6a396b0f86fa06acae126c73457bf2d4d234a5e0 Mon Sep 17 00:00:00 2001 From: bash Date: Fri, 8 May 2026 12:33:54 +0200 Subject: [PATCH] chore: Remove dead SearchForBestPath function and MaxMovementSearchTime config --- conf/playerbots.conf.dist | 4 -- src/Ai/Base/Actions/MovementActions.cpp | 69 ------------------------- src/Ai/Base/Actions/MovementActions.h | 4 -- src/PlayerbotAIConfig.cpp | 1 - src/PlayerbotAIConfig.h | 2 +- 5 files changed, 1 insertion(+), 79 deletions(-) diff --git a/conf/playerbots.conf.dist b/conf/playerbots.conf.dist index 99d3beea5..7d91f1c6e 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -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 diff --git a/src/Ai/Base/Actions/MovementActions.cpp b/src/Ai/Base/Actions/MovementActions.cpp index 61e394338..3d4063306 100644 --- a/src/Ai/Base/Actions/MovementActions.cpp +++ b/src/Ai/Base/Actions/MovementActions.cpp @@ -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) diff --git a/src/Ai/Base/Actions/MovementActions.h b/src/Ai/Base/Actions/MovementActions.h index 1b42cbfc9..c0adaebbe 100644 --- a/src/Ai/Base/Actions/MovementActions.h +++ b/src/Ai/Base/Actions/MovementActions.h @@ -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); }; diff --git a/src/PlayerbotAIConfig.cpp b/src/PlayerbotAIConfig.cpp index 780824b66..8afebf9f1 100644 --- a/src/PlayerbotAIConfig.cpp +++ b/src/PlayerbotAIConfig.cpp @@ -72,7 +72,6 @@ bool PlayerbotAIConfig::Initialize() globalCoolDown = sConfigMgr->GetOption("AiPlayerbot.GlobalCooldown", 500); maxWaitForMove = sConfigMgr->GetOption("AiPlayerbot.MaxWaitForMove", 5000); disableMoveSplinePath = sConfigMgr->GetOption("AiPlayerbot.DisableMoveSplinePath", 0); - maxMovementSearchTime = sConfigMgr->GetOption("AiPlayerbot.MaxMovementSearchTime", 3); expireActionTime = sConfigMgr->GetOption("AiPlayerbot.ExpireActionTime", 5000); dispelAuraDuration = sConfigMgr->GetOption("AiPlayerbot.DispelAuraDuration", 700); reactDelay = sConfigMgr->GetOption("AiPlayerbot.ReactDelay", 100); diff --git a/src/PlayerbotAIConfig.h b/src/PlayerbotAIConfig.h index 70faaa328..84c8aec99 100644 --- a/src/PlayerbotAIConfig.h +++ b/src/PlayerbotAIConfig.h @@ -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,