Use Contains method on Selection when possible.
This allows the set to be utilized for a fast check, rather than degrading to a linear search via LINQ.
This commit is contained in:
@@ -192,7 +192,7 @@ namespace OpenRA.Graphics
|
|||||||
{
|
{
|
||||||
foreach (var g in World.ActorsHavingTrait<Selectable>().Where(a => !a.Disposed
|
foreach (var g in World.ActorsHavingTrait<Selectable>().Where(a => !a.Disposed
|
||||||
&& !World.FogObscures(a)
|
&& !World.FogObscures(a)
|
||||||
&& !World.Selection.Actors.Contains(a)))
|
&& !World.Selection.Contains(a)))
|
||||||
{
|
{
|
||||||
if (Game.Settings.Game.StatusBars == StatusBarsType.Standard)
|
if (Game.Settings.Game.StatusBars == StatusBarsType.Standard)
|
||||||
new SelectionBarsRenderable(g, false, false).Render(this);
|
new SelectionBarsRenderable(g, false, false).Render(this);
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
if (!building.IsInWorld || !building.Owner.IsAlliedWith(building.World.LocalPlayer))
|
if (!building.IsInWorld || !building.Owner.IsAlliedWith(building.World.LocalPlayer))
|
||||||
return SpriteRenderable.None;
|
return SpriteRenderable.None;
|
||||||
|
|
||||||
if (!building.World.Selection.Actors.Contains(building))
|
if (!building.World.Selection.Contains(building))
|
||||||
return SpriteRenderable.None;
|
return SpriteRenderable.None;
|
||||||
|
|
||||||
return RenderInner(wr);
|
return RenderInner(wr);
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
}
|
}
|
||||||
|
|
||||||
var next = bases
|
var next = bases
|
||||||
.SkipWhile(b => !world.Selection.Actors.Contains(b))
|
.SkipWhile(b => !world.Selection.Contains(b))
|
||||||
.Skip(1)
|
.Skip(1)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
var next = facilities
|
var next = facilities
|
||||||
.SkipWhile(b => !world.Selection.Actors.Contains(b))
|
.SkipWhile(b => !world.Selection.Contains(b))
|
||||||
.Skip(1)
|
.Skip(1)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user