From c5c06a2456f0fb41e3baba7d02edf30972d4732f Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Wed, 20 Apr 2022 09:37:00 +0300 Subject: [PATCH] improvementFilter accepts uniques as well --- core/src/com/unciv/models/ruleset/tile/TileImprovement.kt | 1 + .../com/unciv/models/ruleset/unique/UniqueParameterType.kt | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/models/ruleset/tile/TileImprovement.kt b/core/src/com/unciv/models/ruleset/tile/TileImprovement.kt index db5ab75d30..b34ce6f349 100644 --- a/core/src/com/unciv/models/ruleset/tile/TileImprovement.kt +++ b/core/src/com/unciv/models/ruleset/tile/TileImprovement.kt @@ -83,6 +83,7 @@ class TileImprovement : RulesetStatsObject() { "All" -> true "All Road" -> isRoad() "Great Improvement", "Great" -> isGreatImprovement() + in uniques -> true else -> false } } diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueParameterType.kt b/core/src/com/unciv/models/ruleset/unique/UniqueParameterType.kt index 5506cee61a..61052409ce 100644 --- a/core/src/com/unciv/models/ruleset/unique/UniqueParameterType.kt +++ b/core/src/com/unciv/models/ruleset/unique/UniqueParameterType.kt @@ -341,7 +341,9 @@ enum class UniqueParameterType( override fun getErrorSeverity(parameterText: String, ruleset: Ruleset): UniqueType.UniqueComplianceErrorSeverity? { if (parameterText in knownValues) return null - return ImprovementName.getErrorSeverity(parameterText, ruleset) + if (ImprovementName.getErrorSeverity(parameterText, ruleset) == null) return null + if (ruleset.tileImprovements.values.any { it.hasUnique(parameterText) }) return null + return UniqueType.UniqueComplianceErrorSeverity.RulesetSpecific } override fun isTranslationWriterGuess(parameterText: String, ruleset: Ruleset) = parameterText != "All" && getErrorSeverity(parameterText, ruleset) == null