From cd6f77ca7c8d2ad842b457c683243e86378bf1ca Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Thu, 5 May 2011 18:36:38 +1200 Subject: [PATCH] move terrain palette constant lookup outside terrain setup inner loop --- OpenRA.Game/Graphics/TerrainRenderer.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenRA.Game/Graphics/TerrainRenderer.cs b/OpenRA.Game/Graphics/TerrainRenderer.cs index 2bca521f2d..dd43738dc8 100644 --- a/OpenRA.Game/Graphics/TerrainRenderer.cs +++ b/OpenRA.Game/Graphics/TerrainRenderer.cs @@ -39,12 +39,14 @@ namespace OpenRA.Graphics int nv = 0; + var terrainPalette = Game.modData.Palette.GetPaletteIndex("terrain"); + for( int j = map.Bounds.Top; j < map.Bounds.Bottom; j++ ) for( int i = map.Bounds.Left; i < map.Bounds.Right; i++ ) { var tile = tileMapping[map.MapTiles.Value[i, j]]; // TODO: move GetPaletteIndex out of the inner loop. - Util.FastCreateQuad(vertices, Game.CellSize * new float2(i, j), tile, Game.modData.Palette.GetPaletteIndex("terrain"), nv, tile.size); + Util.FastCreateQuad(vertices, Game.CellSize * new float2(i, j), tile, terrainPalette, nv, tile.size); nv += 4; if (tileMapping[map.MapTiles.Value[i, j]].sheet != terrainSheet)