diff --git a/OpenRA.Game/Graphics/TerrainRenderer.cs b/OpenRA.Game/Graphics/TerrainRenderer.cs index 86c869f2e9..9d6e0f89b8 100644 --- a/OpenRA.Game/Graphics/TerrainRenderer.cs +++ b/OpenRA.Game/Graphics/TerrainRenderer.cs @@ -48,7 +48,7 @@ namespace OpenRA.Graphics Sprite tile = tileMapping[map.MapTiles[i, j]]; // TODO: The zero below should explicitly refer to the terrain palette, but this code is called // before the palettes are created. Therefore assumes that "terrain" is the first palette to be defined - Util.FastCreateQuad(vertices, indices, Game.CellSize * new float2(i, j), tile, 0, nv, ni, tile.size); + Util.FastCreateQuad(vertices, indices, Game.CellSize * new float2(i, j), tile, Game.modData.Palette.GetPaletteIndex("terrain"), nv, ni, tile.size); nv += 4; ni += 6; diff --git a/OpenRA.Game/Graphics/WorldRenderer.cs b/OpenRA.Game/Graphics/WorldRenderer.cs index f222f3c26e..b1771344b5 100644 --- a/OpenRA.Game/Graphics/WorldRenderer.cs +++ b/OpenRA.Game/Graphics/WorldRenderer.cs @@ -29,14 +29,13 @@ namespace OpenRA.Graphics internal WorldRenderer(World world) { this.world = world; - + this.palette = Game.modData.Palette; + foreach( var pal in world.traitDict.ActorsWithTraitMultiple( world ) ) + pal.Trait.InitPalette( this ); + terrainRenderer = new TerrainRenderer(world, this); shroudRenderer = new ShroudRenderer(world); uiOverlay = new UiOverlay(); - this.palette = Game.modData.Palette; - - foreach( var pal in world.traitDict.ActorsWithTraitMultiple( world ) ) - pal.Trait.InitPalette( this ); } public int GetPaletteIndex(string name) { return palette.GetPaletteIndex(name); }