Ver código fonte

#3842 - fix negative link cost because of bonuses

Andrii Danylchenko 1 ano atrás
pai
commit
f1d7151a93
1 arquivos alterados com 2 adições e 2 exclusões
  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());
 		}
 	}