From bec879cf7cfda57a18cf3851c0ff2cde1a631401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 5 Jun 2016 13:55:10 +0200 Subject: [PATCH 1/2] Don't check modulare actor templates as the inherited combinations of the actors are of concern. --- OpenRA.Mods.Common/Lint/CheckUpgrades.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenRA.Mods.Common/Lint/CheckUpgrades.cs b/OpenRA.Mods.Common/Lint/CheckUpgrades.cs index 29e6619785..f198ecea31 100644 --- a/OpenRA.Mods.Common/Lint/CheckUpgrades.cs +++ b/OpenRA.Mods.Common/Lint/CheckUpgrades.cs @@ -31,6 +31,9 @@ namespace OpenRA.Mods.Common.Lint foreach (var actorInfo in rules.Actors) { + if (actorInfo.Key.StartsWith("^")) + continue; + foreach (var trait in actorInfo.Value.TraitInfos()) { var fields = trait.GetType().GetFields(); @@ -51,6 +54,9 @@ namespace OpenRA.Mods.Common.Lint // Check all upgrades granted by traits. foreach (var actorInfo in rules.Actors) { + if (actorInfo.Key.StartsWith("^")) + continue; + foreach (var trait in actorInfo.Value.TraitInfos()) { var fields = trait.GetType().GetFields(); From 3b27975b33a2b91e09093bdebaa689c37b49818f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 5 Jun 2016 17:37:36 +0200 Subject: [PATCH 2/2] Also check for a missing UpgradeManager trait as optional upgrades will otherwise be silently non-functional. --- OpenRA.Mods.Common/Lint/CheckUpgrades.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Lint/CheckUpgrades.cs b/OpenRA.Mods.Common/Lint/CheckUpgrades.cs index f198ecea31..88b7cd76db 100644 --- a/OpenRA.Mods.Common/Lint/CheckUpgrades.cs +++ b/OpenRA.Mods.Common/Lint/CheckUpgrades.cs @@ -40,8 +40,14 @@ namespace OpenRA.Mods.Common.Lint foreach (var field in fields.Where(x => x.HasAttribute())) { var values = LintExts.GetFieldValues(trait, field, emitError); - foreach (var value in values.Where(x => !upgradesGranted.Contains(x))) - emitError("Actor type `{0}` uses upgrade `{1}` that is not granted by anything!".F(actorInfo.Key, value)); + foreach (var value in values) + { + if (!upgradesGranted.Contains(value)) + emitError("Actor type `{0}` uses upgrade `{1}` that is not granted by anything!".F(actorInfo.Key, value)); + + if (actorInfo.Value.TraitInfoOrDefault() == null) + emitError("Actor type `{0}` uses upgrade `{1}`, but doesn't have the UpgradeManager trait.".F(actorInfo.Key, value)); + } } } }