Resolved #422 - can no longer move through units of other civs we're at war with

This commit is contained in:
Yair Morgenstern
2019-01-21 20:17:48 +02:00
parent 811ed5a7a2
commit d1de589e4f

View File

@ -132,7 +132,6 @@ class MapUnit {
// so multiple callees of this function have been optimized,
// because optimization on this function results in massive benefits!
fun canPassThrough(tile: TileInfo):Boolean{
val tileOwner = tile.getOwner()
if(tile.getBaseTerrain().impassable) return false
if(tile.isLand() && type.isWaterUnit() && !tile.isCityCenter())
@ -148,8 +147,18 @@ class MapUnit {
if(isOcean && baseUnit.uniques.contains("Cannot enter ocean tiles until Astronomy")
&& !civInfo.tech.isResearched("Astronomy"))
return false
val tileOwner = tile.getOwner()
if(tileOwner!=null && tileOwner.civName!=owner
&& (tile.isCityCenter() || !civInfo.canEnterTiles(tileOwner))) return false
val unitsInTile = tile.getUnits()
if(unitsInTile.isNotEmpty()){
val firstUnit = unitsInTile.first()
if(firstUnit.civInfo != civInfo && civInfo.isAtWarWith(firstUnit.civInfo))
return false
}
return true
}