Unified unit type filters and removed unwanted ones

This commit is contained in:
Yair Morgenstern 2022-04-19 15:21:05 +03:00
parent 9ae84a94e1
commit aa6bd364de

View File

@ -79,26 +79,13 @@ enum class UniqueParameterType(
UnitTypeFilter("unitType", "Unit Type Filters") { UnitTypeFilter("unitType", "Unit Type Filters") {
// As you can see there is a difference between these and what's in unitTypeStrings (for translation) - // As you can see there is a difference between these and what's in unitTypeStrings (for translation) -
// the goal is to unify, but for now this is the "real" list // the goal is to unify, but for now this is the "real" list
private val knownValues = setOf("All", "Melee", "Ranged", "Civilian", "Military", "Land", "Water", "Air", // Note: this can't handle combinations of parameters (e.g. [{Military} {Water}])
"non-air", "Nuclear Weapon", "Great Person", "Religious", "Barbarian") private val knownValues = setOf(
// TODO make this obsolete "All", "Melee", "Ranged", "Civilian", "Military", "Land", "Water", "Air",
private val unitTypeStrings = setOf( "non-air", "Nuclear Weapon", "Great Person", "Religious", "Barbarian",
"Military", "relevant", "City",
"Civilian",
"non-air",
"relevant",
"Nuclear Weapon",
"City",
"Barbarian",
"Great Person",
// These are up for debate // These are up for debate
"Air", // "land units", "water units", "air units", "military units", "submarine units",
"land units",
"water units",
"air units",
"military units",
"submarine units",
// Note: this can't handle combinations of parameters (e.g. [{Military} {Water}])
) )
override fun getErrorSeverity(parameterText: String, ruleset: Ruleset): override fun getErrorSeverity(parameterText: String, ruleset: Ruleset):
@ -110,8 +97,9 @@ enum class UniqueParameterType(
} }
override fun isTranslationWriterGuess(parameterText: String, ruleset: Ruleset) = override fun isTranslationWriterGuess(parameterText: String, ruleset: Ruleset) =
parameterText in ruleset.unitTypes.keys || parameterText in unitTypeStrings parameterText in ruleset.unitTypes.keys || parameterText in getTranslationWriterStringsForOutput()
override fun getTranslationWriterStringsForOutput() = unitTypeStrings
override fun getTranslationWriterStringsForOutput() = knownValues
}, },
UnitName("unit") { UnitName("unit") {