perf: minor speedup in distance to tiles

This commit is contained in:
yairm210 2024-09-16 04:10:31 +03:00
parent b3e00a7944
commit f78fbfd22d

View File

@ -69,7 +69,8 @@ class UnitMovement(val unit: MapUnit) {
}
}
if (!distanceToTiles.containsKey(neighbor) || distanceToTiles[neighbor]!!.totalDistance > totalDistanceToTile) { // this is the new best path
val currentBestPath = distanceToTiles[neighbor]
if (currentBestPath == null || currentBestPath.totalDistance > totalDistanceToTile) { // this is the new best path
val usableMovement = if (includeOtherEscortUnit && unit.isEscorting())
minOf(unitMovement, unit.getOtherEscortUnit()!!.currentMovement)
else unitMovement