From e57c3018effc9bf44f2d05c3ec29f80aabb141a7 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 7 Nov 2022 20:28:02 +0200 Subject: [PATCH] Resolved #7982 - Misspelling replacement text contains conditionals --- core/src/com/unciv/models/ruleset/Ruleset.kt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/core/src/com/unciv/models/ruleset/Ruleset.kt b/core/src/com/unciv/models/ruleset/Ruleset.kt index 80dfb2671e..c126834436 100644 --- a/core/src/com/unciv/models/ruleset/Ruleset.kt +++ b/core/src/com/unciv/models/ruleset/Ruleset.kt @@ -458,13 +458,12 @@ class Ruleset { val text = "$name's unique \"${unique.text}\" looks like it may be a misspelling of:\n" + similarUniques.joinToString("\n") { uniqueType -> - val deprecationAnnotation = - UniqueType::class.java.getField(uniqueType.name) - .getAnnotation(Deprecated::class.java) - if (deprecationAnnotation == null) - "\"${uniqueType.text}\"" - else - "\"${uniqueType.text}\" (Deprecated)" + var text = "\"${uniqueType.text}" + if (unique.conditionals.isNotEmpty()) + text += " " + unique.conditionals.joinToString(" ") { "<${it.text}>" } + text += "\"" + if (uniqueType.getDeprecationAnnotation() != null) text += " (Deprecated)" + return@joinToString text }.prependIndent("\t") listOf(RulesetError(text, RulesetErrorSeverity.OK)) }