From ad2327828d21b5a94de351715e31d2d3486a8be4 Mon Sep 17 00:00:00 2001 From: Oliver Brakmann Date: Sun, 20 Jul 2014 16:13:19 +0200 Subject: [PATCH 1/2] Make actors outside map borders selectable for their owner PR #5967 only made planes not lose their selection when they strayed outside the map border. This PR makes it possible to select them when they already are outside the map. It also ensures that the selection decorations are drawn. Rank designations, however, will disappear when a unit leaves the map. Fixes #5651 for real, then. --- OpenRA.Game/Selection.cs | 2 +- OpenRA.Game/Traits/SelectionDecorations.cs | 8 +------- OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/OpenRA.Game/Selection.cs b/OpenRA.Game/Selection.cs index fd08eb1e24..1bd7d26aeb 100644 --- a/OpenRA.Game/Selection.cs +++ b/OpenRA.Game/Selection.cs @@ -61,7 +61,7 @@ namespace OpenRA public void Tick(World world) { - actors.RemoveAll(a => !a.IsInWorld || (a.Owner != world.LocalPlayer && world.FogObscures(a))); + actors.RemoveAll(a => !a.IsInWorld || (!a.Owner.IsAlliedWith(world.LocalPlayer) && world.FogObscures(a))); foreach (var cg in controlGroups.Values) // note: NOT `!a.IsInWorld`, since that would remove things that are in transports. diff --git a/OpenRA.Game/Traits/SelectionDecorations.cs b/OpenRA.Game/Traits/SelectionDecorations.cs index 233624e1d8..1c886071dc 100644 --- a/OpenRA.Game/Traits/SelectionDecorations.cs +++ b/OpenRA.Game/Traits/SelectionDecorations.cs @@ -38,7 +38,7 @@ namespace OpenRA.Traits public IEnumerable RenderAfterWorld(WorldRenderer wr) { - if (self.World.FogObscures(self)) + if (!self.Owner.IsAlliedWith(self.World.RenderPlayer) && self.World.FogObscures(self)) yield break; var b = self.Bounds.Value; @@ -74,9 +74,6 @@ namespace OpenRA.Traits IEnumerable DrawPips(WorldRenderer wr, Actor self, int2 basePosition) { - if (!self.Owner.IsAlliedWith(self.World.RenderPlayer)) - yield break; - var pipSources = self.TraitsImplementing(); if (!pipSources.Any()) yield break; @@ -118,9 +115,6 @@ namespace OpenRA.Traits IEnumerable DrawTags(WorldRenderer wr, Actor self, int2 basePosition) { - if (!self.Owner.IsAlliedWith(self.World.RenderPlayer)) - yield break; - var tagImages = new Animation(self.World, "pips"); var pal = wr.Palette(Info.Palette); var tagxyOffset = new int2(0, 6); diff --git a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs index b5320243dc..355f459855 100644 --- a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs @@ -239,7 +239,7 @@ namespace OpenRA.Widgets static IEnumerable SelectActorsInBox(World world, int2 a, int2 b, Func cond) { return world.ScreenMap.ActorsInBox(a, b) - .Where(x => x.HasTrait() && x.Trait().Info.Selectable && !world.FogObscures(x) && cond(x)) + .Where(x => x.HasTrait() && x.Trait().Info.Selectable && (x.Owner.IsAlliedWith(world.RenderPlayer) || !world.FogObscures(x)) && cond(x)) .GroupBy(x => x.GetSelectionPriority()) .OrderByDescending(g => g.Key) .Select(g => g.AsEnumerable()) From e97efc89cbb78af429c8b8a019fb9f4faf3c7ced Mon Sep 17 00:00:00 2001 From: Oliver Brakmann Date: Sun, 20 Jul 2014 17:37:50 +0200 Subject: [PATCH 2/2] Make aircraft not waste their missiles by firing from outside the map Fixes #6001. This obviously affects Yaks as well as Migs, even though Yaks had no trouble with attacking from outside the map. --- OpenRA.Mods.RA/Air/AttackPlane.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.RA/Air/AttackPlane.cs b/OpenRA.Mods.RA/Air/AttackPlane.cs index c259ad2b3a..6025e8a27d 100755 --- a/OpenRA.Mods.RA/Air/AttackPlane.cs +++ b/OpenRA.Mods.RA/Air/AttackPlane.cs @@ -29,8 +29,8 @@ namespace OpenRA.Mods.RA.Air protected override bool CanAttack(Actor self, Target target) { - // dont fire while landed - return base.CanAttack(self, target) && self.CenterPosition.Z > 0; + // dont fire while landed or when outside the map + return base.CanAttack(self, target) && self.CenterPosition.Z > 0 && self.World.Map.Contains(self.Location); } } }