mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 06:51:30 -04:00
If we're already at it, same thing for anti-local effects, this should help performance in the tileInfo.getStats() function
This commit is contained in:
parent
bf568a44eb
commit
b7f9472308
@ -727,14 +727,14 @@ class CityInfo {
|
|||||||
// Matching uniques provided by sources in the city itself
|
// Matching uniques provided by sources in the city itself
|
||||||
fun getLocalMatchingUniques(placeholderText: String): Sequence<Unique> {
|
fun getLocalMatchingUniques(placeholderText: String): Sequence<Unique> {
|
||||||
return cityConstructions.builtBuildingUniqueMap.getUniques(placeholderText)
|
return cityConstructions.builtBuildingUniqueMap.getUniques(placeholderText)
|
||||||
.filter { it.params.none { param -> param == "in other cities" } } +
|
.filter { !it.isAntiLocalEffect } +
|
||||||
religion.getUniques().filter { it.placeholderText == placeholderText }
|
religion.getUniques().filter { it.placeholderText == placeholderText }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getLocalMatchingUniques(uniqueType: UniqueType, stateForConditionals: StateForConditionals? = null): Sequence<Unique> {
|
fun getLocalMatchingUniques(uniqueType: UniqueType, stateForConditionals: StateForConditionals? = null): Sequence<Unique> {
|
||||||
return (
|
return (
|
||||||
cityConstructions.builtBuildingUniqueMap.getUniques(uniqueType)
|
cityConstructions.builtBuildingUniqueMap.getUniques(uniqueType)
|
||||||
.filter { it.params.none { param -> param == "in other cities" } }
|
.filter { !it.isAntiLocalEffect }
|
||||||
+ religion.getUniques().filter { it.isOfType(uniqueType) }
|
+ religion.getUniques().filter { it.isOfType(uniqueType) }
|
||||||
).filter {
|
).filter {
|
||||||
it.conditionalsApply(stateForConditionals)
|
it.conditionalsApply(stateForConditionals)
|
||||||
|
@ -27,6 +27,7 @@ class Unique(val text: String, val sourceObjectType: UniqueTarget? = null, val s
|
|||||||
val allParams = params + conditionals.flatMap { it.params }
|
val allParams = params + conditionals.flatMap { it.params }
|
||||||
|
|
||||||
val isLocalEffect = params.contains("in this city")
|
val isLocalEffect = params.contains("in this city")
|
||||||
|
val isAntiLocalEffect = params.contains("in other cities")
|
||||||
|
|
||||||
fun isOfType(uniqueType: UniqueType) = uniqueType == type
|
fun isOfType(uniqueType: UniqueType) = uniqueType == type
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user