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] 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)); + } } } }