mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-25 12:54:06 -04:00
Update BarbarianManager.kt
This commit is contained in:
parent
132195ad1a
commit
9b878bef6d
@ -54,13 +54,15 @@ class BarbarianManager : IsPartOfGameInfoSerialization {
|
||||
|
||||
fun updateEncampments() {
|
||||
// Check if camps were destroyed
|
||||
for (encampment in encampments.toList()) { // tolist to avoid concurrent modification
|
||||
val iterator = encampments.iterator()
|
||||
while (iterator.hasNext()) {
|
||||
val encampment = iterator.next()
|
||||
if (tileMap[encampment.position].improvement != Constants.barbarianEncampment) {
|
||||
encampment.wasDestroyed()
|
||||
}
|
||||
// Check if the ghosts are ready to depart
|
||||
if (encampment.destroyed && encampment.countdown == 0)
|
||||
encampments.remove(encampment)
|
||||
iterator.remove()
|
||||
}
|
||||
|
||||
// Possibly place a new encampment
|
||||
|
Loading…
x
Reference in New Issue
Block a user