From 884fbc0ea95273d4df63fc945131b3f6150d7152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Wed, 2 Jul 2014 09:26:40 +0200 Subject: [PATCH] add a new lint check for invalid map cordons --- OpenRA.Mods.RA/Lint/CheckMapCordon.cs | 29 +++++++++++++++++++++++++++ OpenRA.Mods.RA/OpenRA.Mods.RA.csproj | 1 + 2 files changed, 30 insertions(+) create mode 100644 OpenRA.Mods.RA/Lint/CheckMapCordon.cs diff --git a/OpenRA.Mods.RA/Lint/CheckMapCordon.cs b/OpenRA.Mods.RA/Lint/CheckMapCordon.cs new file mode 100644 index 0000000000..2e5e9f0572 --- /dev/null +++ b/OpenRA.Mods.RA/Lint/CheckMapCordon.cs @@ -0,0 +1,29 @@ +#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 CheckMapCordon : ILintPass + { + public void Run(Action emitError, Action emitWarning, Map map) + { + if (map.Bounds.Left == 0 || map.Bounds.Top == 0 + || map.Bounds.Right == map.MapSize.X || map.Bounds.Bottom == map.MapSize.Y) + emitError("This map does not define a valid cordon.\n" + +"A one cell (or greater) border is required on all four sides " + +"between the playable bounds and the map edges"); + } + } +} + diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 88a75a8b9c..d60a95b5ce 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -519,6 +519,7 @@ +