mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-04 23:40:01 +07:00
Big performance improvement - don't need to string-compare every param of every unique of every building each time we're looking for global uniques
This commit is contained in:
@ -749,21 +749,21 @@ class CityInfo {
|
||||
// Get all matching uniques that don't apply to only this city
|
||||
fun getMatchingUniquesWithNonLocalEffects(placeholderText: String): Sequence<Unique> {
|
||||
return cityConstructions.builtBuildingUniqueMap.getUniques(placeholderText)
|
||||
.filter { it.params.none { param -> param == "in this city" } }
|
||||
.filter { !it.isLocalEffect }
|
||||
// Note that we don't query religion here, as those only have local effects
|
||||
}
|
||||
|
||||
|
||||
fun getMatchingUniquesWithNonLocalEffects(uniqueType: UniqueType): Sequence<Unique> {
|
||||
return cityConstructions.builtBuildingUniqueMap.getUniques(uniqueType)
|
||||
.filter { it.params.none { param -> param == "in this city" } }
|
||||
.filter { !it.isLocalEffect }
|
||||
// Note that we don't query religion here, as those only have local effects
|
||||
}
|
||||
|
||||
// Get all uniques that don't apply to only this city
|
||||
fun getAllUniquesWithNonLocalEffects(): Sequence<Unique> {
|
||||
return cityConstructions.builtBuildingUniqueMap.getAllUniques()
|
||||
.filter { it.params.none { param -> param == "in this city" } }
|
||||
.filter { !it.isLocalEffect }
|
||||
// Note that we don't query religion here, as those only have local effects
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,8 @@ class Unique(val text: String, val sourceObjectType: UniqueTarget? = null, val s
|
||||
|
||||
val allParams = params + conditionals.flatMap { it.params }
|
||||
|
||||
val isLocalEffect = params.contains("in this city")
|
||||
|
||||
fun isOfType(uniqueType: UniqueType) = uniqueType == type
|
||||
|
||||
fun conditionalsApply(civInfo: CivilizationInfo? = null, city: CityInfo? = null): Boolean {
|
||||
|
Reference in New Issue
Block a user