diff --git a/OpenRA.Game/Orders/UnitOrderGenerator.cs b/OpenRA.Game/Orders/UnitOrderGenerator.cs index 0a5b459709..1ad91aaa36 100644 --- a/OpenRA.Game/Orders/UnitOrderGenerator.cs +++ b/OpenRA.Game/Orders/UnitOrderGenerator.cs @@ -21,7 +21,7 @@ namespace OpenRA.Orders static Target TargetForInput(World world, CPos cell, int2 worldPixel, MouseInput mi) { var actor = world.ScreenMap.ActorsAt(mi) - .Where(a => !world.FogObscures(a) && a.Info.HasTraitInfo()) + .Where(a => a.Info.HasTraitInfo() && !world.FogObscures(a)) .WithHighestSelectionPriority(worldPixel); if (actor != null) diff --git a/OpenRA.Mods.Common/Effects/SpriteEffect.cs b/OpenRA.Mods.Common/Effects/SpriteEffect.cs index c256b3084e..1f7ddda5dc 100644 --- a/OpenRA.Mods.Common/Effects/SpriteEffect.cs +++ b/OpenRA.Mods.Common/Effects/SpriteEffect.cs @@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Effects public IEnumerable Render(WorldRenderer wr) { - if (world.FogObscures(pos) && !visibleThroughFog) + if (!visibleThroughFog && world.FogObscures(pos)) return SpriteRenderable.None; var zoom = scaleSizeWithZoom ? 1f / wr.Viewport.Zoom : 1f; diff --git a/OpenRA.Mods.Common/Orders/GuardOrderGenerator.cs b/OpenRA.Mods.Common/Orders/GuardOrderGenerator.cs index c610d6ee17..24f96070ec 100644 --- a/OpenRA.Mods.Common/Orders/GuardOrderGenerator.cs +++ b/OpenRA.Mods.Common/Orders/GuardOrderGenerator.cs @@ -57,9 +57,10 @@ namespace OpenRA.Mods.Common.Orders static IEnumerable FriendlyGuardableUnits(World world, MouseInput mi) { return world.ScreenMap.ActorsAt(mi) - .Where(a => !world.FogObscures(a) && !a.IsDead && + .Where(a => !a.IsDead && a.AppearsFriendlyTo(world.LocalPlayer.PlayerActor) && - a.Info.HasTraitInfo()); + a.Info.HasTraitInfo() && + !world.FogObscures(a)); } } } diff --git a/OpenRA.Mods.Common/Traits/Render/WithParachute.cs b/OpenRA.Mods.Common/Traits/Render/WithParachute.cs index 84411d2d99..1e4d789b5c 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithParachute.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithParachute.cs @@ -159,10 +159,7 @@ namespace OpenRA.Mods.Common.Traits.Render if (info.ShadowImage == null) return Enumerable.Empty(); - if (IsTraitDisabled) - return Enumerable.Empty(); - - if (self.IsDead || !self.IsInWorld) + if (IsTraitDisabled || self.IsDead || !self.IsInWorld) return Enumerable.Empty(); if (self.World.FogObscures(self)) diff --git a/OpenRA.Mods.Common/Traits/Render/WithSpriteControlGroupDecoration.cs b/OpenRA.Mods.Common/Traits/Render/WithSpriteControlGroupDecoration.cs index d720ac3008..272d6a8f7a 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithSpriteControlGroupDecoration.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithSpriteControlGroupDecoration.cs @@ -49,10 +49,10 @@ namespace OpenRA.Mods.Common.Traits.Render IEnumerable IRenderAboveShroudWhenSelected.RenderAboveShroud(Actor self, WorldRenderer wr) { - if (self.World.FogObscures(self)) + if (self.Owner != wr.World.LocalPlayer) yield break; - if (self.Owner != wr.World.LocalPlayer) + if (self.World.FogObscures(self)) yield break; var pal = wr.Palette(Info.Palette); diff --git a/OpenRA.Mods.Common/Traits/Render/WithTextControlGroupDecoration.cs b/OpenRA.Mods.Common/Traits/Render/WithTextControlGroupDecoration.cs index 21f34d42b4..8b91cdb237 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithTextControlGroupDecoration.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithTextControlGroupDecoration.cs @@ -66,10 +66,10 @@ namespace OpenRA.Mods.Common.Traits.Render IEnumerable IRenderAboveShroudWhenSelected.RenderAboveShroud(Actor self, WorldRenderer wr) { - if (self.World.FogObscures(self)) + if (self.Owner != wr.World.LocalPlayer) yield break; - if (self.Owner != wr.World.LocalPlayer) + if (self.World.FogObscures(self)) yield break; foreach (var r in DrawControlGroup(self, wr)) diff --git a/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs b/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs index f137f98a37..0f86fbc540 100644 --- a/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs @@ -185,7 +185,7 @@ namespace OpenRA.Mods.Common.Widgets var worldPixel = worldRenderer.Viewport.ViewToWorldPx(Viewport.LastMousePos); var underCursor = world.ScreenMap.ActorsAt(worldPixel) - .Where(a => !world.FogObscures(a) && a.Info.HasTraitInfo()) + .Where(a => a.Info.HasTraitInfo() && !world.FogObscures(a)) .WithHighestSelectionPriority(worldPixel); if (underCursor != null)