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:
@@ -42,8 +42,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
protected virtual bool IsVisibleInner(Actor self, Player byPlayer)
|
||||
{
|
||||
if (Info.Type == VisibilityType.Footprint)
|
||||
return self.OccupiesSpace.OccupiedCells()
|
||||
.Any(o => byPlayer.Shroud.IsExplored(o.First));
|
||||
return byPlayer.Shroud.AnyExplored(self.OccupiesSpace.OccupiedCells());
|
||||
|
||||
return byPlayer.Shroud.IsExplored(self.CenterPosition);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user