Only check for and render selection bars for actors on screen.
This avoids expensive FogObscures checks and saves drawing selections bars for actors that are offscreen anyway.
This commit is contained in:
@@ -190,9 +190,12 @@ namespace OpenRA.Graphics
|
|||||||
|
|
||||||
if (World.Type == WorldType.Regular)
|
if (World.Type == WorldType.Regular)
|
||||||
{
|
{
|
||||||
foreach (var g in World.ActorsHavingTrait<Selectable>().Where(a => !a.Disposed
|
foreach (var g in World.ScreenMap.ActorsInBox(Viewport.TopLeft, Viewport.BottomRight)
|
||||||
&& !World.FogObscures(a)
|
.Where(a =>
|
||||||
&& !World.Selection.Contains(a)))
|
!a.Disposed &&
|
||||||
|
!World.Selection.Contains(a) &&
|
||||||
|
a.Info.HasTraitInfo<SelectableInfo>() &&
|
||||||
|
!World.FogObscures(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);
|
||||||
|
|||||||
Reference in New Issue
Block a user