Can no longer walk through enemy units =)

This commit is contained in:
Yair Morgenstern
2018-05-23 00:42:33 +03:00
parent db4ad20264
commit f01b6b665f

View File

@ -36,9 +36,9 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
for (neighbor in tileToCheck.neighbors) { for (neighbor in tileToCheck.neighbors) {
var totalDistanceToTile:Float var totalDistanceToTile:Float
if (neighbor.getOwner() != unit.civInfo if ((neighbor.getOwner() != unit.civInfo && neighbor.isCityCenter())// Enemy city,
&& neighbor.isCityCenter()) || neighbor.unit!=null && neighbor.unit!!.civInfo!=unit.civInfo) // Enemy unit
totalDistanceToTile = unitMovement // Enemy city, can't move through it - we'll be "stuck" there totalDistanceToTile = unitMovement // can't move through it - we'll be "stuck" there
else { else {
val distanceBetweenTiles = getMovementCostBetweenAdjacentTiles(tileToCheck, neighbor) val distanceBetweenTiles = getMovementCostBetweenAdjacentTiles(tileToCheck, neighbor)