Преглед на файлове

Merge pull request #3847 from vcmi/fix-3842

#3842 - fix negative link cost because of bonuses
Ivan Savenko преди 1 година
родител
ревизия
8fd2849b0b
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 2 2
      AI/Nullkiller/Pathfinding/ObjectGraph.cpp

+ 2 - 2
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());
 		}
 	}