diff --git a/OpenRa.Game/Graphics/WorldRenderer.cs b/OpenRa.Game/Graphics/WorldRenderer.cs index c6c1d9faad..512d170a90 100644 --- a/OpenRa.Game/Graphics/WorldRenderer.cs +++ b/OpenRa.Game/Graphics/WorldRenderer.cs @@ -77,7 +77,7 @@ namespace OpenRa.Graphics foreach (var e in world.Effects) DrawSpriteList(rect, e.Render()); - uiOverlay.Draw(); + uiOverlay.Draw( world ); spriteRenderer.Flush(); diff --git a/OpenRa.Game/Orders/PlaceBuildingOrderGenerator.cs b/OpenRa.Game/Orders/PlaceBuildingOrderGenerator.cs index 12a565fb88..2e586f3489 100644 --- a/OpenRa.Game/Orders/PlaceBuildingOrderGenerator.cs +++ b/OpenRa.Game/Orders/PlaceBuildingOrderGenerator.cs @@ -49,7 +49,7 @@ namespace OpenRa.Orders public void Render( World world ) { - world.WorldRenderer.uiOverlay.DrawBuildingGrid( Building, BuildingInfo ); + world.WorldRenderer.uiOverlay.DrawBuildingGrid( world, Building, BuildingInfo ); } public Cursor GetCursor(World world, int2 xy, MouseInput mi) diff --git a/OpenRa.Game/UiOverlay.cs b/OpenRa.Game/UiOverlay.cs index 0af585ffc1..555ab223b7 100644 --- a/OpenRa.Game/UiOverlay.cs +++ b/OpenRa.Game/UiOverlay.cs @@ -34,24 +34,24 @@ namespace OpenRa return SheetBuilder.Add( data, new Size(Game.CellSize,Game.CellSize) ); } - public void Draw() + public void Draw( World world ) { if (ShowUnitDebug) for (var j = 0; j < 128; j++) for (var i = 0; i < 128; i++) - if (Game.world.UnitInfluence.GetUnitsAt(new int2(i, j)).Any()) + if (world.UnitInfluence.GetUnitsAt(new int2(i, j)).Any()) spriteRenderer.DrawSprite(unitDebug, Game.CellSize * new float2(i, j), 0); } - public void DrawBuildingGrid( string name, BuildingInfo bi ) + public void DrawBuildingGrid( World world, string name, BuildingInfo bi ) { var position = Game.controller.MousePosition.ToInt2(); var topLeft = position - Footprint.AdjustForBuildingSize( bi ); - var isCloseEnough = Game.world.IsCloseEnoughToBase(Game.world.LocalPlayer, name, bi, topLeft); + var isCloseEnough = world.IsCloseEnoughToBase(world.LocalPlayer, name, bi, topLeft); foreach( var t in Footprint.Tiles( name, bi, topLeft ) ) - spriteRenderer.DrawSprite( ( isCloseEnough && Game.world.IsCellBuildable( t, bi.WaterBound - ? UnitMovementType.Float : UnitMovementType.Wheel ) && !Game.world.Map.ContainsResource( t ) ) + spriteRenderer.DrawSprite( ( isCloseEnough && world.IsCellBuildable( t, bi.WaterBound + ? UnitMovementType.Float : UnitMovementType.Wheel ) && !world.Map.ContainsResource( t ) ) ? buildOk : buildBlocked, Game.CellSize * t, 0 ); spriteRenderer.Flush(); diff --git a/OpenRa.Game/WorldUtils.cs b/OpenRa.Game/WorldUtils.cs index 925db9fdca..36f18f485b 100755 --- a/OpenRa.Game/WorldUtils.cs +++ b/OpenRa.Game/WorldUtils.cs @@ -93,7 +93,7 @@ namespace OpenRa { return world.FindUnits(a, b) .Where( x => x.traits.Contains() ) - .GroupBy(x => (x.Owner == Game.world.LocalPlayer) ? x.Info.Traits.Get().Priority : 0) + .GroupBy(x => (x.Owner == world.LocalPlayer) ? x.Info.Traits.Get().Priority : 0) .OrderByDescending(g => g.Key) .Select( g => g.AsEnumerable() ) .DefaultIfEmpty( new Actor[] {} )