mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-07 14:02:48 +07:00
Performance improvements
- unit unique check uses map, not array search
This commit is contained in:
parent
e634423b2f
commit
ead83b912b
@ -311,7 +311,7 @@ class BaseUnit : RulesetObject(), INonPerpetualConstruction {
|
||||
// "military units" --> "Military", using invariant locale
|
||||
&& matchesFilter(filter.removeSuffix(" units").lowercase().replaceFirstChar { it.uppercaseChar() })
|
||||
) return true
|
||||
return uniques.contains(filter)
|
||||
return uniqueMap.contains(filter)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,9 +42,8 @@ class UnitType() : RulesetObject() {
|
||||
"Land" -> isLandUnit()
|
||||
"Water" -> isWaterUnit()
|
||||
"Air" -> isAirUnit()
|
||||
else -> {
|
||||
uniques.contains(filter)
|
||||
}
|
||||
in uniqueMap -> true
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user