From 52631409115459fd0b97bea94680592710a5d183 Mon Sep 17 00:00:00 2001 From: yairm210 Date: Sat, 6 Apr 2024 23:30:28 +0300 Subject: [PATCH] Fixed concurrent modification from triggers adding other triggers --- core/src/com/unciv/logic/civilization/Civilization.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/logic/civilization/Civilization.kt b/core/src/com/unciv/logic/civilization/Civilization.kt index ee29c7a1bd..99be5ffcce 100644 --- a/core/src/com/unciv/logic/civilization/Civilization.kt +++ b/core/src/com/unciv/logic/civilization/Civilization.kt @@ -496,7 +496,7 @@ class Civilization : IsPartOfGameInfoSerialization { fun getTriggeredUniques( trigger: UniqueType, stateForConditionals: StateForConditionals = StateForConditionals(this) - ) : Sequence = sequence { + ) : Iterable = sequence { yieldAll(nation.uniqueMap.getTriggeredUniques(trigger, stateForConditionals)) yieldAll(cities.asSequence() .flatMap { city -> city.cityConstructions.builtBuildingUniqueMap.getTriggeredUniques(trigger, stateForConditionals) } @@ -509,7 +509,7 @@ class Civilization : IsPartOfGameInfoSerialization { yieldAll(tech.techUniques.getTriggeredUniques(trigger, stateForConditionals)) yieldAll(getEra().uniqueMap.getTriggeredUniques (trigger, stateForConditionals)) yieldAll(gameInfo.ruleset.globalUniques.uniqueMap.getTriggeredUniques(trigger, stateForConditionals)) - } + }.toList() // Triggers can e.g. add buildings which contain triggers, causing concurrent modification errors fun matchesFilter(filter: String): Boolean { return MultiFilter.multiFilter(filter, ::matchesSingleFilter)