From 17d72f17d9c77eec39786da55e93b6512ddc9252 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 27 Jul 2011 02:56:29 +1200 Subject: [PATCH] Add an EditorTilesetFilter trait for filtering the actor palette based on tileset. --- OpenRA.Editor/Form1.cs | 7 +++++++ OpenRA.Game/OpenRA.Game.csproj | 1 + OpenRA.Game/Traits/EditorTilesetFilter.cs | 20 ++++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 OpenRA.Game/Traits/EditorTilesetFilter.cs diff --git a/OpenRA.Editor/Form1.cs b/OpenRA.Editor/Form1.cs index dea04c0e80..b5e58ad577 100755 --- a/OpenRA.Editor/Form1.cs +++ b/OpenRA.Editor/Form1.cs @@ -155,6 +155,13 @@ namespace OpenRA.Editor { var info = Rules.Info[a]; if (!info.Traits.Contains()) continue; + + var etf = info.Traits.GetOrDefault(); + if (etf != null && etf.ExcludeTilesets != null + && etf.ExcludeTilesets.Contains(tileset.Id)) continue; + if (etf != null && etf.RequireTilesets != null + && !etf.RequireTilesets.Contains(tileset.Id)) continue; + var template = RenderUtils.RenderActor(info, tileset, palette); var ibox = new PictureBox { diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index 8ce96ce671..58323d8270 100755 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -184,6 +184,7 @@ + diff --git a/OpenRA.Game/Traits/EditorTilesetFilter.cs b/OpenRA.Game/Traits/EditorTilesetFilter.cs new file mode 100644 index 0000000000..ad91c9904f --- /dev/null +++ b/OpenRA.Game/Traits/EditorTilesetFilter.cs @@ -0,0 +1,20 @@ +#region Copyright & License Information +/* + * Copyright 2007-2011 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 + +namespace OpenRA.Traits +{ + public class EditorTilesetFilterInfo : TraitInfo + { + public readonly string[] RequireTilesets = null; + public readonly string[] ExcludeTilesets = null; + } + + public class EditorTilesetFilter { } +}