mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-18 11:49:19 +07:00
Destroy planes when city is razed.
This commit is contained in:

committed by
Yair Morgenstern

parent
9b86055fc7
commit
2305f18233
@ -261,11 +261,14 @@ class CityInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun destroyCity() {
|
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?
|
// 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!
|
// Well, the water unit has to return to the water!
|
||||||
for(unit in getCenterTile().getUnits())
|
for(unit in getCenterTile().getUnits()) {
|
||||||
if(!unit.movement.canPassThrough(getCenterTile()))
|
if (!unit.movement.canPassThrough(getCenterTile()))
|
||||||
unit.movement.teleportToClosestMoveableTile()
|
unit.movement.teleportToClosestMoveableTile()
|
||||||
|
}
|
||||||
|
|
||||||
civInfo.cities = civInfo.cities.toMutableList().apply { remove(this@CityInfo) }
|
civInfo.cities = civInfo.cities.toMutableList().apply { remove(this@CityInfo) }
|
||||||
getTiles().forEach { expansion.relinquishOwnership(it) }
|
getTiles().forEach { expansion.relinquishOwnership(it) }
|
||||||
|
Reference in New Issue
Block a user