From 2317325591868206ba7bcb0374713bc066b33b86 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Mon, 18 Apr 2011 07:37:29 +1200 Subject: [PATCH] add a lint pass to catch Mirey's bogus autotarget wiring cases --- .../Lint/LintBuildablePrerequisites.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.RA/Lint/LintBuildablePrerequisites.cs b/OpenRA.Mods.RA/Lint/LintBuildablePrerequisites.cs index 557e479627..07cbcc7971 100644 --- a/OpenRA.Mods.RA/Lint/LintBuildablePrerequisites.cs +++ b/OpenRA.Mods.RA/Lint/LintBuildablePrerequisites.cs @@ -20,7 +20,23 @@ namespace OpenRA.Mods.RA { public void Run(Action emitError) { - emitError("Hello World"); + /* do something intelligent here. */ } } + + class CheckAutotargetWiring : ILintPass + { + public void Run(Action emitError) + { + foreach( var i in Rules.Info ) + { + if (i.Key.StartsWith("^")) + continue; + var attackMove = i.Value.Traits.GetOrDefault(); + if (attackMove != null && !attackMove.JustMove && + !i.Value.Traits.Contains()) + emitError( "{0} has AttackMove setup without AutoTarget, and will crash when resolving that order.".F(i.Key) ); + } + } + } }