mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-26 05:14:32 -04:00
Allow multifilter uniques to count for filtering
This commit is contained in:
parent
0cfee86864
commit
abc876f4a1
@ -15,14 +15,20 @@ import com.unciv.models.ruleset.unique.UniqueType
|
||||
|
||||
class UniqueValidator(val ruleset: Ruleset) {
|
||||
|
||||
|
||||
/** Used to determine if certain uniques are used for filtering */
|
||||
private val allNonTypedUniques = HashSet<String>()
|
||||
/** Used to determine if certain uniques are used for filtering */
|
||||
private val allUniqueParameters = HashSet<String>()
|
||||
|
||||
private fun addToHashsets(uniqueHolder: IHasUniques) {
|
||||
for (unique in uniqueHolder.uniqueObjects) {
|
||||
if (unique.type == null) allNonTypedUniques.add(unique.text)
|
||||
else allUniqueParameters.addAll(unique.allParams)
|
||||
else allUniqueParameters.addAll(unique.allParams.flatMap {
|
||||
// Multifilters have the actual filtering uniques
|
||||
it.removePrefix("{").removeSuffix("}").split("} {")}
|
||||
// Non-filters
|
||||
.map { if (it.startsWith("non-[")) {it.removePrefix("non-[").removeSuffix("]")} else it }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user