Fixed modification exception when destroying transported units

This commit is contained in:
Yair Morgenstern 2020-04-26 20:50:09 +03:00
parent 5e5a175f06
commit f0adc40e81

View file

@ -477,7 +477,7 @@ class MapUnit {
civInfo.removeUnit(this)
civInfo.updateViewableTiles()
// all transported units should be destroyed as well
currentTile.getUnits().filter { it.isTransported && isTransportTypeOf(it) }
currentTile.getUnits().filter { it.isTransported && isTransportTypeOf(it) }.toList() // because we're changing the list
.forEach { unit -> unit.destroy() }
}