fix some extraneous refs to Game.world

This commit is contained in:
Bob
2010-04-13 20:25:16 +12:00
parent 2a4460213c
commit e38d978849
9 changed files with 42 additions and 41 deletions

View File

@@ -79,7 +79,7 @@ namespace OpenRA.Graphics
static Cache<string, TerrainColorSet> terrainTypeColors = new Cache<string, TerrainColorSet>(
theater =>
{
return new TerrainColorSet(Game.world.WorldActor.Info.Traits.WithInterface<TheaterInfo>().FirstOrDefault(t => t.Theater == theater).MapColors);
return new TerrainColorSet(Rules.Info["world"].Traits.WithInterface<TheaterInfo>().FirstOrDefault(t => t.Theater == theater).MapColors);
});
static Color shroudColor;
@@ -194,7 +194,7 @@ namespace OpenRA.Graphics
lineRenderer.FillRect(new RectangleF(
Game.viewport.Location.X + pos.X + 2,
Game.viewport.Location.Y + pos.Y + 2,
12, 12), Player.PlayerColors[ p.Second.PaletteIndex % Player.PlayerColors.Count() ].c);
12, 12), Player.PlayerColors(world)[ p.Second.PaletteIndex % Player.PlayerColors(world).Count() ].c);
rgbaRenderer.DrawSprite(ownedSpawnPoint, pos, "chrome");
}

View File

@@ -31,11 +31,13 @@ namespace OpenRA.Graphics
IIndexBuffer indexBuffer;
Sheet terrainSheet;
World world;
Renderer renderer;
Map map;
public TerrainRenderer(World world, Renderer renderer, WorldRenderer wr)
{
this.world = world;
this.renderer = renderer;
this.map = world.Map;
@@ -88,9 +90,9 @@ namespace OpenRA.Graphics
if (firstRow < 0) firstRow = 0;
if (lastRow > map.Height) lastRow = map.Height;
if (Game.world.LocalPlayer != null && !Game.world.LocalPlayer.Shroud.Disabled && Game.world.LocalPlayer.Shroud.bounds.HasValue)
if (world.LocalPlayer != null && !world.LocalPlayer.Shroud.Disabled && world.LocalPlayer.Shroud.bounds.HasValue)
{
var r = Game.world.LocalPlayer.Shroud.bounds.Value;
var r = world.LocalPlayer.Shroud.bounds.Value;
if (firstRow < r.Top - map.YOffset)
firstRow = r.Top - map.YOffset;
@@ -107,7 +109,7 @@ namespace OpenRA.Graphics
new Range<int>(indicesPerRow * firstRow, indicesPerRow * lastRow),
PrimitiveType.TriangleList, renderer.SpriteShader));
foreach (var r in Game.world.WorldActor.traits.WithInterface<IRenderOverlay>())
foreach (var r in world.WorldActor.traits.WithInterface<IRenderOverlay>())
r.Render();
}
}

View File

@@ -166,11 +166,11 @@ namespace OpenRA.Graphics
if (world.LocalPlayer != null)
DrawBox(world.LocalPlayer.Shroud.bounds.Value, Color.Blue);
for (var j = 0; j < Game.world.Map.MapSize.Y;
j += Game.world.WorldActor.Info.Traits.Get<SpatialBinsInfo>().BinSize)
for (var j = 0; j < world.Map.MapSize.Y;
j += world.WorldActor.Info.Traits.Get<SpatialBinsInfo>().BinSize)
{
lineRenderer.DrawLine(new float2(0, j * 24), new float2(Game.world.Map.MapSize.X * 24, j * 24), Color.Black, Color.Black);
lineRenderer.DrawLine(new float2(j * 24, 0), new float2(j * 24, Game.world.Map.MapSize.Y * 24), Color.Black, Color.Black);
lineRenderer.DrawLine(new float2(0, j * 24), new float2(world.Map.MapSize.X * 24, j * 24), Color.Black, Color.Black);
lineRenderer.DrawLine(new float2(j * 24, 0), new float2(j * 24, world.Map.MapSize.Y * 24), Color.Black, Color.Black);
}
}