From f1d7151a934356627b0f9f0569fc07412f75d833 Mon Sep 17 00:00:00 2001 From: Andrii Danylchenko Date: Sun, 28 Apr 2024 09:11:00 +0300 Subject: [PATCH] #3842 - fix negative link cost because of bonuses --- AI/Nullkiller/Pathfinding/ObjectGraph.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AI/Nullkiller/Pathfinding/ObjectGraph.cpp b/AI/Nullkiller/Pathfinding/ObjectGraph.cpp index 17a58c697..a30c41876 100644 --- a/AI/Nullkiller/Pathfinding/ObjectGraph.cpp +++ b/AI/Nullkiller/Pathfinding/ObjectGraph.cpp @@ -504,11 +504,11 @@ void ObjectGraph::connectHeroes(const Nullkiller * ai) auto heroPos = path.targetHero->visitablePos(); nodes[pos].connections[heroPos].update( - path.movementCost(), + std::max(0.0f, path.movementCost()), path.getPathDanger()); nodes[heroPos].connections[pos].update( - path.movementCost(), + std::max(0.0f, path.movementCost()), path.getPathDanger()); } }