mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-13 17:28:57 +07:00
More concurrency problem fixes in nuke effects
This commit is contained in:
@ -546,7 +546,7 @@ object Battle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Damage and/or destroy units on the tile
|
// Damage and/or destroy units on the tile
|
||||||
for (unit in tile.getUnits()) {
|
for (unit in tile.getUnits().toList()) { // tolist so if it's destroyed there's no concurrent modification
|
||||||
val defender = MapUnitCombatant(unit)
|
val defender = MapUnitCombatant(unit)
|
||||||
if (defender.unit.baseUnit.unitType.isCivilian()) {
|
if (defender.unit.baseUnit.unitType.isCivilian()) {
|
||||||
unit.destroy() // destroy the unit
|
unit.destroy() // destroy the unit
|
||||||
@ -611,7 +611,7 @@ object Battle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Destroy all hit units
|
// Destroy all hit units
|
||||||
for (defender in tile.getUnits()) {
|
for (defender in tile.getUnits().toList()) { // toList to avoid concurent modification exceptions
|
||||||
defender.destroy()
|
defender.destroy()
|
||||||
postBattleNotifications(attacker, MapUnitCombatant(defender), defender.currentTile)
|
postBattleNotifications(attacker, MapUnitCombatant(defender), defender.currentTile)
|
||||||
destroyIfDefeated(defender.civInfo, attacker.getCivInfo())
|
destroyIfDefeated(defender.civInfo, attacker.getCivInfo())
|
||||||
|
Reference in New Issue
Block a user