Refactor occupied cells visibility checks.
Provide some common extension methods to reduce code duplication, and also use loops instead of LINQ to reduce allocations and provide a minor speedup.
This commit is contained in:
@@ -70,8 +70,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
// If fog is disabled visibility is determined by shroud
|
||||
if (!byPlayer.Shroud.FogEnabled)
|
||||
return self.OccupiesSpace.OccupiedCells()
|
||||
.Any(o => byPlayer.Shroud.IsExplored(o.First));
|
||||
return byPlayer.Shroud.AnyExplored(self.OccupiesSpace.OccupiedCells());
|
||||
|
||||
return initialized && stateByPlayer[byPlayer].IsVisible;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user