diff --git a/core/src/com/unciv/logic/city/CityInfo.kt b/core/src/com/unciv/logic/city/CityInfo.kt index 61be2aad61..184eeabf8f 100644 --- a/core/src/com/unciv/logic/city/CityInfo.kt +++ b/core/src/com/unciv/logic/city/CityInfo.kt @@ -192,6 +192,12 @@ class CityInfo { } fun destroyCity() { + // Edge case! What if a water unit is in a city, and you raze the city? + // Well, the water unit has to return to the water! + for(unit in getCenterTile().getUnits()) + if(!unit.canPassThrough(getCenterTile())) + unit.movementAlgs().teleportToClosestMoveableTile() + civInfo.cities = civInfo.cities.toMutableList().apply { remove(this@CityInfo) } getTiles().forEach { expansion.relinquishOwnership(it) } getCenterTile().improvement="City ruins" diff --git a/core/src/com/unciv/logic/map/MapUnit.kt b/core/src/com/unciv/logic/map/MapUnit.kt index c9314475a0..de7c67c132 100644 --- a/core/src/com/unciv/logic/map/MapUnit.kt +++ b/core/src/com/unciv/logic/map/MapUnit.kt @@ -134,7 +134,7 @@ class MapUnit { val tileOwner = tile.getOwner() if(tile.getBaseTerrain().impassable) return false - if(tile.isLand() && type.isWaterUnit()) + if(tile.isLand() && type.isWaterUnit() && !tile.isCityCenter()) return false val isOcean = tile.baseTerrain == "Ocean" diff --git a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt index 9794912056..48b033c6c9 100644 --- a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt +++ b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt @@ -7,8 +7,7 @@ class UnitMovementAlgorithms(val unit:MapUnit) { private fun getMovementCostBetweenAdjacentTiles(from: TileInfo, to: TileInfo): Float { - if(from.isLand() && to.isWater() - || from.isWater() && to.isLand()) + if(unit.type.isLandUnit() && (from.isLand() != to.isLand())) return 100f // this is embarkment or disembarkment, and will take the entire turn if (from.roadStatus === RoadStatus.Railroad && to.roadStatus === RoadStatus.Railroad)