don't look up resource type every cell for ore, too

This commit is contained in:
Chris Forbes
2010-09-24 20:40:56 +12:00
parent 8021fc3b20
commit aba76f4b50
2 changed files with 5 additions and 1 deletions

View File

@@ -37,6 +37,9 @@ namespace OpenRA.Traits
var miny = cliprect.Top; var miny = cliprect.Top;
var maxy = cliprect.Bottom; var maxy = cliprect.Bottom;
foreach( var rt in world.WorldActor.TraitsImplementing<ResourceType>() )
rt.info.PaletteIndex = world.WorldRenderer.GetPaletteIndex(rt.info.Palette);
for (int x = minx; x < maxx; x++) for (int x = minx; x < maxx; x++)
for (int y = miny; y < maxy; y++) for (int y = miny; y < maxy; y++)
{ {
@@ -48,7 +51,7 @@ namespace OpenRA.Traits
if (c.image != null) if (c.image != null)
c.image[c.density].DrawAt( c.image[c.density].DrawAt(
Game.CellSize * new int2(x, y), Game.CellSize * new int2(x, y),
c.type.info.Palette); c.type.info.PaletteIndex);
} }
} }

View File

@@ -23,6 +23,7 @@ namespace OpenRA.Traits
public readonly string TerrainType = "Ore"; public readonly string TerrainType = "Ore";
public Sprite[][] Sprites; public Sprite[][] Sprites;
public int PaletteIndex;
public object Create(ActorInitializer init) { return new ResourceType(this); } public object Create(ActorInitializer init) { return new ResourceType(this); }
} }