From 2305f1823322f9bbae860e595bdf9210f0931d56 Mon Sep 17 00:00:00 2001 From: Duan Tao Date: Thu, 3 Oct 2019 21:14:35 +0800 Subject: [PATCH] Destroy planes when city is razed. --- core/src/com/unciv/logic/city/CityInfo.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/logic/city/CityInfo.kt b/core/src/com/unciv/logic/city/CityInfo.kt index 7628be26f9..a0bd1ec199 100644 --- a/core/src/com/unciv/logic/city/CityInfo.kt +++ b/core/src/com/unciv/logic/city/CityInfo.kt @@ -261,11 +261,14 @@ class CityInfo { } fun destroyCity() { + for(airUnit in getCenterTile().airUnits.toList()) airUnit.destroy() //Destroy planes stationed in city + // 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.movement.canPassThrough(getCenterTile())) + for(unit in getCenterTile().getUnits()) { + if (!unit.movement.canPassThrough(getCenterTile())) unit.movement.teleportToClosestMoveableTile() + } civInfo.cities = civInfo.cities.toMutableList().apply { remove(this@CityInfo) } getTiles().forEach { expansion.relinquishOwnership(it) }