mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-16 18:59:15 +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() {
|
||||
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) }
|
||||
|
Reference in New Issue
Block a user