From 80c4870a0f642565009f47bf916e29fe776b7582 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 23 Aug 2014 09:53:27 +1200 Subject: [PATCH 1/2] =?UTF-8?q?Don=E2=80=99t=20clear=20shroud=20outside=20?= =?UTF-8?q?the=20map.=20=20Fixes=20#6097.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenRA.Game/Traits/World/Shroud.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenRA.Game/Traits/World/Shroud.cs b/OpenRA.Game/Traits/World/Shroud.cs index 6e51f639f4..e579db257f 100644 --- a/OpenRA.Game/Traits/World/Shroud.cs +++ b/OpenRA.Game/Traits/World/Shroud.cs @@ -217,7 +217,8 @@ namespace OpenRA.Traits public void ExploreAll(World world) { - explored.Clear(true); + foreach (var cell in map.Cells) + explored[cell] = true; Invalidate(); } From 2acfc23f18d77ab695de1cf515a92abafe1ba42c Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 23 Aug 2014 10:52:36 +1200 Subject: [PATCH 2/2] Account for map edges in Shroud.IsExploredCore. --- OpenRA.Game/Traits/World/Shroud.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenRA.Game/Traits/World/Shroud.cs b/OpenRA.Game/Traits/World/Shroud.cs index e579db257f..ed3233f52e 100644 --- a/OpenRA.Game/Traits/World/Shroud.cs +++ b/OpenRA.Game/Traits/World/Shroud.cs @@ -41,6 +41,7 @@ namespace OpenRA.Traits public int Hash { get; private set; } static readonly Func TruthPredicate = cell => true; + readonly Func shroudEdgeTest; readonly Func fastExploredTest; readonly Func slowExploredTest; readonly Func fastVisibleTest; @@ -63,6 +64,7 @@ namespace OpenRA.Traits fogVisibilities = Exts.Lazy(() => self.TraitsImplementing().ToArray()); + shroudEdgeTest = cell => map.Contains(cell); fastExploredTest = IsExploredCore; slowExploredTest = IsExplored; fastVisibleTest = IsVisibleCore; @@ -256,9 +258,9 @@ namespace OpenRA.Traits if (!map.Cells.Contains(region)) return slowExploredTest; - // If shroud isn't enabled, then we can see everything. + // If shroud isn't enabled, then we can see everything inside the map. if (!ShroudEnabled) - return TruthPredicate; + return shroudEdgeTest; // If shroud is enabled, we can use the fast test that just does the core check. return fastExploredTest;