From ba1fa7cd8179b3ed0c9e36fa2e4f81a365c50367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sat, 28 Jun 2014 09:50:50 +0200 Subject: [PATCH] new check for undefined actors --- OpenRA.Mods.RA/Lint/CheckActors.cs | 28 ++++++++++++++++++++++++++++ OpenRA.Mods.RA/OpenRA.Mods.RA.csproj | 1 + 2 files changed, 29 insertions(+) create mode 100644 OpenRA.Mods.RA/Lint/CheckActors.cs diff --git a/OpenRA.Mods.RA/Lint/CheckActors.cs b/OpenRA.Mods.RA/Lint/CheckActors.cs new file mode 100644 index 0000000000..c6c259f3d0 --- /dev/null +++ b/OpenRA.Mods.RA/Lint/CheckActors.cs @@ -0,0 +1,28 @@ +#region Copyright & License Information +/* + * Copyright 2007-2014 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation. For more information, + * see COPYING. + */ +#endregion + +using System; +using System.Linq; +using OpenRA.Traits; + +namespace OpenRA.Mods.RA +{ + public class CheckActors : ILintPass + { + public void Run(Action emitError, Action emitWarning, Map map) + { + var actorTypes = map.Actors.Value.Values.Select(a => a.Type); + foreach (var actor in actorTypes) + if (!map.Rules.Actors.Keys.Contains(actor.ToLowerInvariant())) + emitError("Actor {0} is not defined by any rule.".F(actor)); + } + } +} + diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index aeb4fdda34..88a75a8b9c 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -518,6 +518,7 @@ +