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) {
var totalDistanceToTile:Float
if (neighbor.getOwner() != unit.civInfo
&& neighbor.isCityCenter())
totalDistanceToTile = unitMovement // Enemy city, can't move through it - we'll be "stuck" there
if ((neighbor.getOwner() != unit.civInfo && neighbor.isCityCenter())// Enemy city,
|| neighbor.unit!=null && neighbor.unit!!.civInfo!=unit.civInfo) // Enemy unit
totalDistanceToTile = unitMovement // can't move through it - we'll be "stuck" there
else {
val distanceBetweenTiles = getMovementCostBetweenAdjacentTiles(tileToCheck, neighbor)