From 81d53a4f1afeeab0ca6b6a3234e92f04a225b7f2 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 3 Nov 2018 12:40:54 +0000 Subject: [PATCH] Improve error message for children of removals. --- OpenRA.Mods.Common/Lint/CheckUnknownTraitFields.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Lint/CheckUnknownTraitFields.cs b/OpenRA.Mods.Common/Lint/CheckUnknownTraitFields.cs index 5dba154a14..cbd41ad6b1 100644 --- a/OpenRA.Mods.Common/Lint/CheckUnknownTraitFields.cs +++ b/OpenRA.Mods.Common/Lint/CheckUnknownTraitFields.cs @@ -37,18 +37,19 @@ namespace OpenRA.Mods.Common.Lint // Removals can never define children if (t.Key.StartsWith("-", StringComparison.Ordinal) && t.Value.Nodes.Any()) { - emitError("{0} has child nodes, which is not valid for removals.".F(t.Key)); + emitError("{0} defines child nodes, which are not valid for removals.".F(t.Location)); continue; } + var traitName = NormalizeName(t.Key); + // Inherits can never define children - if (NormalizeName(t.Key) == "Inherits" && t.Value.Nodes.Any()) + if (traitName == "Inherits" && t.Value.Nodes.Any()) { emitError("{0} defines child nodes, which are not valid for Inherits.".F(t.Location)); continue; } - var traitName = NormalizeName(t.Key); var traitInfo = modData.ObjectCreator.FindType(traitName + "Info"); foreach (var field in t.Value.Nodes) {