From 851512a84e937b98aadf5eeac31b0d42c5d3b05a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 24 Mar 2013 22:02:45 +0100 Subject: [PATCH] eliminate public CursorProvider.Palettes don't hand over the cursor palette to the world renderer at all still update worldrender palette (set and apply modifiers) --- OpenRA.Game/Graphics/CursorProvider.cs | 7 +++---- OpenRA.Game/Graphics/WorldRenderer.cs | 5 ++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/OpenRA.Game/Graphics/CursorProvider.cs b/OpenRA.Game/Graphics/CursorProvider.cs index cffd64422f..0896b21be9 100644 --- a/OpenRA.Game/Graphics/CursorProvider.cs +++ b/OpenRA.Game/Graphics/CursorProvider.cs @@ -20,7 +20,6 @@ namespace OpenRA.Graphics { public static class CursorProvider { - public static Dictionary Palettes { get; private set; } public static HardwarePalette Palette; static Dictionary cursors; @@ -36,12 +35,12 @@ namespace OpenRA.Graphics ShadowIndex[ShadowIndex.Length - 1] = Convert.ToInt32(sequences.NodesDict["ShadowIndex"].Value); } - Palettes = new Dictionary(); + var palettes = new Dictionary(); foreach (var s in sequences.NodesDict["Palettes"].Nodes) - Palettes.Add(s.Key, new Palette(FileSystem.Open(s.Value.Value), ShadowIndex)); + palettes.Add(s.Key, new Palette(FileSystem.Open(s.Value.Value), ShadowIndex)); Palette = new HardwarePalette(); - foreach (var p in CursorProvider.Palettes) + foreach (var p in palettes) Palette.AddPalette(p.Key, p.Value, false); // Generate initial palette texture diff --git a/OpenRA.Game/Graphics/WorldRenderer.cs b/OpenRA.Game/Graphics/WorldRenderer.cs index ebbb1ed0f3..830b80acb7 100644 --- a/OpenRA.Game/Graphics/WorldRenderer.cs +++ b/OpenRA.Game/Graphics/WorldRenderer.cs @@ -41,12 +41,15 @@ namespace OpenRA.Graphics internal WorldRenderer(World world) { this.world = world; - palette = CursorProvider.Palette; + palette = new HardwarePalette(); palettes = new Cache(CreatePaletteReference); foreach (var pal in world.traitDict.ActorsWithTraitMultiple(world)) pal.Trait.InitPalette( this ); + // Generate initial palette texture + palette.Update(new IPaletteModifier[] {}); + terrainRenderer = new TerrainRenderer(world, this); shroudRenderer = new ShroudRenderer(world); }