diff --git a/OpenRA.Game/Traits/World/BibLayer.cs b/OpenRA.Game/Traits/World/BibLayer.cs index cf0360dfa7..8781b38512 100644 --- a/OpenRA.Game/Traits/World/BibLayer.cs +++ b/OpenRA.Game/Traits/World/BibLayer.cs @@ -84,12 +84,18 @@ namespace OpenRA.Traits } public void Render() - { - var tl = world.Map.TopLeft; - var br = world.Map.BottomRight; + { + var cliprect = Game.viewport.ShroudBounds().HasValue + ? Rectangle.Intersect(Game.viewport.ShroudBounds().Value, world.Map.Bounds) : world.Map.Bounds; - for (int x = tl.X; x < br.X; x++) - for (int y = tl.Y; y < br.Y; y++) + var minx = cliprect.Left; + var maxx = cliprect.Right; + + var miny = cliprect.Top; + var maxy = cliprect.Bottom; + + for (int x = minx; x < maxx; x++) + for (int y = miny; y < maxy; y++) { var t = new int2(x, y); if (world.LocalPlayer != null && !world.LocalPlayer.Shroud.IsExplored(t) || tiles[x,y].type == 0) continue; diff --git a/OpenRA.Game/Traits/World/ResourceLayer.cs b/OpenRA.Game/Traits/World/ResourceLayer.cs index c35e0d9521..73eeca9cab 100644 --- a/OpenRA.Game/Traits/World/ResourceLayer.cs +++ b/OpenRA.Game/Traits/World/ResourceLayer.cs @@ -22,6 +22,7 @@ using System; using System.Linq; using OpenRA.Graphics; using OpenRA.GameRules; +using System.Drawing; namespace OpenRA.Traits { @@ -45,13 +46,17 @@ namespace OpenRA.Traits public void Render() { - var map = world.Map; + var cliprect = Game.viewport.ShroudBounds().HasValue + ? Rectangle.Intersect(Game.viewport.ShroudBounds().Value, world.Map.Bounds) : world.Map.Bounds; - var tl = world.Map.TopLeft; - var br = world.Map.BottomRight; + var minx = cliprect.Left; + var maxx = cliprect.Right; - for (int x = tl.X; x < br.X; x++) - for (int y = tl.Y; y < br.Y; y++) + var miny = cliprect.Top; + var maxy = cliprect.Bottom; + + for (int x = minx; x < maxx; x++) + for (int y = miny; y < maxy; y++) { if (world.LocalPlayer != null && !world.LocalPlayer.Shroud.IsExplored(new int2(x, y))) continue;