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.
This commit is contained in:
Oliver Brakmann
2014-07-20 16:13:19 +02:00
parent 2d02e3f04a
commit ad2327828d
3 changed files with 3 additions and 9 deletions

View File

@@ -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.

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Traits
public IEnumerable<IRenderable> 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<IRenderable> DrawPips(WorldRenderer wr, Actor self, int2 basePosition)
{
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer))
yield break;
var pipSources = self.TraitsImplementing<IPips>();
if (!pipSources.Any())
yield break;
@@ -118,9 +115,6 @@ namespace OpenRA.Traits
IEnumerable<IRenderable> 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);

View File

@@ -239,7 +239,7 @@ namespace OpenRA.Widgets
static IEnumerable<Actor> SelectActorsInBox(World world, int2 a, int2 b, Func<Actor, bool> cond)
{
return world.ScreenMap.ActorsInBox(a, b)
.Where(x => x.HasTrait<Selectable>() && x.Trait<Selectable>().Info.Selectable && !world.FogObscures(x) && cond(x))
.Where(x => x.HasTrait<Selectable>() && x.Trait<Selectable>().Info.Selectable && (x.Owner.IsAlliedWith(world.RenderPlayer) || !world.FogObscures(x)) && cond(x))
.GroupBy(x => x.GetSelectionPriority())
.OrderByDescending(g => g.Key)
.Select(g => g.AsEnumerable())