From fc15aa47addab0a9042bfd354df5da0b20798f2a Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 19 Jul 2011 19:10:00 +1200 Subject: [PATCH] dont really need to setup palettes every frame in ResourceLayer --- OpenRA.Game/Traits/World/ResourceLayer.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/OpenRA.Game/Traits/World/ResourceLayer.cs b/OpenRA.Game/Traits/World/ResourceLayer.cs index c8b573c87d..d3c508a3d4 100644 --- a/OpenRA.Game/Traits/World/ResourceLayer.cs +++ b/OpenRA.Game/Traits/World/ResourceLayer.cs @@ -24,10 +24,16 @@ namespace OpenRA.Traits public ResourceType[] resourceTypes; CellContents[,] content; + bool hasSetupPalettes; + public void Render( WorldRenderer wr ) { - foreach( var rt in world.WorldActor.TraitsImplementing() ) - rt.info.PaletteIndex = wr.GetPaletteIndex(rt.info.Palette); + if (!hasSetupPalettes) + { + hasSetupPalettes = true; + foreach( var rt in world.WorldActor.TraitsImplementing() ) + rt.info.PaletteIndex = wr.GetPaletteIndex(rt.info.Palette); + } var clip = Game.viewport.WorldBounds(world); for (int x = clip.Left; x < clip.Right; x++)