mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 13:55:54 -04:00
Performance improvement for getting civ-wide uniques, should help mitigate existing ANRs
This commit is contained in:
parent
4b43ff5b5e
commit
fda3d32332
@ -342,11 +342,12 @@ class CivilizationInfo {
|
||||
|
||||
fun hasResource(resourceName: String): Boolean = getCivResourcesByName()[resourceName]!! > 0
|
||||
|
||||
// This function should be removed and replaced by marking where uniques originate from, hopefully.
|
||||
fun getCivWideBuildingUniques(cityItIsFor: CityInfo?): Sequence<Unique> =
|
||||
cities.asSequence().flatMap {
|
||||
city ->
|
||||
if (cityItIsFor != null && city == cityItIsFor)
|
||||
city.getAllUniquesWithNonLocalEffects().filter { it.params.none { param -> param == "in other cities" || param == "in all cities" } }
|
||||
city.getAllUniquesWithNonLocalEffects().filter { !it.isAntiLocalEffect }
|
||||
else city.getAllUniquesWithNonLocalEffects()
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user