mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-04 07:17:50 +07:00
Performance improvements
- forCivGetMatchingUniques doesn't toString stateForConditionals if the result would anyway not be cached
This commit is contained in:
@ -316,7 +316,7 @@ class LocalUniqueCache(val cache:Boolean = true) {
|
||||
val stateForConditionals = if (ignoreConditionals) StateForConditionals.IgnoreConditionals
|
||||
else StateForConditionals(city.civ, city)
|
||||
return get(
|
||||
"city-${city.id}-${uniqueType.name}-${stateForConditionals}",
|
||||
"city-${city.id}-${uniqueType.name}-${ignoreConditionals}",
|
||||
city.getMatchingUniques(uniqueType, stateForConditionals)
|
||||
)
|
||||
}
|
||||
@ -328,9 +328,11 @@ class LocalUniqueCache(val cache:Boolean = true) {
|
||||
civ
|
||||
)
|
||||
): Sequence<Unique> {
|
||||
val sequence = civ.getMatchingUniques(uniqueType, stateForConditionals)
|
||||
if (!cache) return sequence // So we don't need to toString the stateForConditionals
|
||||
return get(
|
||||
"civ-${civ.civName}-${uniqueType.name}-${stateForConditionals}",
|
||||
civ.getMatchingUniques(uniqueType, stateForConditionals)
|
||||
sequence
|
||||
)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user