Mod error detection improvements!

Separated Warning vs Error, show "options only" warning in options only, color warnings by severity
This commit is contained in:
yairm210 2021-09-23 12:04:16 +03:00
parent 2e8934af17
commit bae8bd2468
2 changed files with 10 additions and 7 deletions

View File

@ -296,10 +296,13 @@ class Ruleset {
val deprecationAnnotation = unique.type.declaringClass.getField(unique.type.name)
.getAnnotation(Deprecated::class.java)
if (deprecationAnnotation != null) {
// Not user-visible
lines.add("$name's unique \"${unique.text}\" is deprecated ${deprecationAnnotation.message}," +
" replace with \"${deprecationAnnotation.replaceWith.expression}\"",
RulesetErrorSeverity.WarningOptionsOnly)
val deprecationText = "$name's unique \"${unique.text}\" is deprecated ${deprecationAnnotation.message}," +
" replace with \"${deprecationAnnotation.replaceWith.expression}\""
val severity = if(deprecationAnnotation.level == DeprecationLevel.WARNING)
RulesetErrorSeverity.WarningOptionsOnly // Not user-visible
else RulesetErrorSeverity.Warning // User visible
lines.add(deprecationText, severity)
}
}
}

View File

@ -52,11 +52,11 @@ enum class UniqueType(val text:String, vararg target: UniqueTarget) {
FreeUnits("[amount] units cost no maintenance", UniqueTarget.Global),
UnitMaintenanceDiscount("[amount]% maintenance costs for [mapUnitFilter] units", UniqueTarget.Global),
@Deprecated("As of 3.16.16", ReplaceWith("[amount]% maintenance costs for [mapUnitFilter] units"))
@Deprecated("As of 3.16.16", ReplaceWith("[amount]% maintenance costs for [mapUnitFilter] units"), DeprecationLevel.WARNING)
DecreasedUnitMaintenanceCostsByFilter("-[amount]% [mapUnitFilter] unit maintenance costs"), // No conditional support
@Deprecated("As of 3.16.16", ReplaceWith("[amount]% maintenance costs for [mapUnitFilter] units"))
@Deprecated("As of 3.16.16", ReplaceWith("[amount]% maintenance costs for [mapUnitFilter] units"), DeprecationLevel.WARNING)
DecreasedUnitMaintenanceCostsGlobally("-[amount]% unit upkeep costs"), // No conditional support
@Deprecated("As of 3.16.16", ReplaceWith("[stats] <if this city has at least [amount] specialists>"))
@Deprecated("As of 3.16.16", ReplaceWith("[stats] <if this city has at least [amount] specialists>"), DeprecationLevel.WARNING)
StatBonusForNumberOfSpecialists("[stats] if this city has at least [amount] specialists"), // No conditional support
// TODO: Unify these (I'm in favor of "gain a free" above "provides" because it fits more cases)