Account for map edges in Shroud.IsExploredCore.
This commit is contained in:
@@ -41,6 +41,7 @@ namespace OpenRA.Traits
|
|||||||
public int Hash { get; private set; }
|
public int Hash { get; private set; }
|
||||||
|
|
||||||
static readonly Func<CPos, bool> TruthPredicate = cell => true;
|
static readonly Func<CPos, bool> TruthPredicate = cell => true;
|
||||||
|
readonly Func<CPos, bool> shroudEdgeTest;
|
||||||
readonly Func<CPos, bool> fastExploredTest;
|
readonly Func<CPos, bool> fastExploredTest;
|
||||||
readonly Func<CPos, bool> slowExploredTest;
|
readonly Func<CPos, bool> slowExploredTest;
|
||||||
readonly Func<CPos, bool> fastVisibleTest;
|
readonly Func<CPos, bool> fastVisibleTest;
|
||||||
@@ -63,6 +64,7 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
fogVisibilities = Exts.Lazy(() => self.TraitsImplementing<IFogVisibilityModifier>().ToArray());
|
fogVisibilities = Exts.Lazy(() => self.TraitsImplementing<IFogVisibilityModifier>().ToArray());
|
||||||
|
|
||||||
|
shroudEdgeTest = cell => map.Contains(cell);
|
||||||
fastExploredTest = IsExploredCore;
|
fastExploredTest = IsExploredCore;
|
||||||
slowExploredTest = IsExplored;
|
slowExploredTest = IsExplored;
|
||||||
fastVisibleTest = IsVisibleCore;
|
fastVisibleTest = IsVisibleCore;
|
||||||
@@ -256,9 +258,9 @@ namespace OpenRA.Traits
|
|||||||
if (!map.Cells.Contains(region))
|
if (!map.Cells.Contains(region))
|
||||||
return slowExploredTest;
|
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)
|
if (!ShroudEnabled)
|
||||||
return TruthPredicate;
|
return shroudEdgeTest;
|
||||||
|
|
||||||
// If shroud is enabled, we can use the fast test that just does the core check.
|
// If shroud is enabled, we can use the fast test that just does the core check.
|
||||||
return fastExploredTest;
|
return fastExploredTest;
|
||||||
|
|||||||
Reference in New Issue
Block a user