Rename FindUnits -> FindActorsInBox.
This commit is contained in:
@@ -73,7 +73,7 @@ namespace OpenRA.Graphics
|
|||||||
var bounds = Game.viewport.WorldBounds(world);
|
var bounds = Game.viewport.WorldBounds(world);
|
||||||
var comparer = new RenderableComparer(this);
|
var comparer = new RenderableComparer(this);
|
||||||
|
|
||||||
var actors = world.FindUnits(
|
var actors = world.FindActorsInBox(
|
||||||
bounds.TopLeftAsCPos(),
|
bounds.TopLeftAsCPos(),
|
||||||
bounds.BottomRightAsCPos());
|
bounds.BottomRightAsCPos());
|
||||||
|
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ namespace OpenRA.Widgets
|
|||||||
static readonly Actor[] NoActors = {};
|
static readonly Actor[] NoActors = {};
|
||||||
IEnumerable<Actor> SelectActorsInBox(World world, PPos a, PPos b, Func<Actor, bool> cond)
|
IEnumerable<Actor> SelectActorsInBox(World world, PPos a, PPos b, Func<Actor, bool> cond)
|
||||||
{
|
{
|
||||||
return world.FindUnits(a.ToWPos(0), b.ToWPos(0))
|
return world.FindActorsInBox(a.ToWPos(0), b.ToWPos(0))
|
||||||
.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 && !world.FogObscures(x) && cond(x))
|
||||||
.GroupBy(x => x.GetSelectionPriority())
|
.GroupBy(x => x.GetSelectionPriority())
|
||||||
.OrderByDescending(g => g.Key)
|
.OrderByDescending(g => g.Key)
|
||||||
|
|||||||
@@ -24,15 +24,15 @@ namespace OpenRA
|
|||||||
public static IEnumerable<Actor> FindUnitsAtMouse(this World world, int2 mouseLocation)
|
public static IEnumerable<Actor> FindUnitsAtMouse(this World world, int2 mouseLocation)
|
||||||
{
|
{
|
||||||
var loc = Game.viewport.ViewToWorldPx(mouseLocation).ToWPos(0);
|
var loc = Game.viewport.ViewToWorldPx(mouseLocation).ToWPos(0);
|
||||||
return FindUnits(world, loc, loc).Where(a => !world.FogObscures(a));
|
return FindActorsInBox(world, loc, loc).Where(a => !world.FogObscures(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<Actor> FindUnits(this World world, CPos tl, CPos br)
|
public static IEnumerable<Actor> FindActorsInBox(this World world, CPos tl, CPos br)
|
||||||
{
|
{
|
||||||
return world.FindUnits(tl.TopLeft, br.BottomRight);
|
return world.FindActorsInBox(tl.TopLeft, br.BottomRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<Actor> FindUnits(this World world, WPos tl, WPos br)
|
public static IEnumerable<Actor> FindActorsInBox(this World world, WPos tl, WPos br)
|
||||||
{
|
{
|
||||||
var a = PPos.FromWPos(tl);
|
var a = PPos.FromWPos(tl);
|
||||||
var b = PPos.FromWPos(br);
|
var b = PPos.FromWPos(br);
|
||||||
@@ -59,7 +59,7 @@ namespace OpenRA
|
|||||||
// Target ranges are calculated in 2D, so ignore height differences
|
// Target ranges are calculated in 2D, so ignore height differences
|
||||||
var vec = new WVec(r, r, WRange.Zero);
|
var vec = new WVec(r, r, WRange.Zero);
|
||||||
var rSq = r.Range*r.Range;
|
var rSq = r.Range*r.Range;
|
||||||
return world.FindUnits(origin - vec, origin + vec).Where(a =>
|
return world.FindActorsInBox(origin - vec, origin + vec).Where(a =>
|
||||||
{
|
{
|
||||||
var pos = a.CenterPosition;
|
var pos = a.CenterPosition;
|
||||||
var dx = (long)(pos.X - origin.X);
|
var dx = (long)(pos.X - origin.X);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
{
|
{
|
||||||
if (!limitedAmmo.GiveAmmo()) return NextActivity;
|
if (!limitedAmmo.GiveAmmo()) return NextActivity;
|
||||||
|
|
||||||
var hostBuilding = self.World.FindUnits(self.CenterPosition, self.CenterPosition)
|
var hostBuilding = self.World.FindActorsInBox(self.CenterPosition, self.CenterPosition)
|
||||||
.FirstOrDefault(a => a.HasTrait<RenderBuilding>());
|
.FirstOrDefault(a => a.HasTrait<RenderBuilding>());
|
||||||
|
|
||||||
if (hostBuilding != null)
|
if (hostBuilding != null)
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
if (self.Trait<IMove>().Altitude != 0)
|
if (self.Trait<IMove>().Altitude != 0)
|
||||||
return null; // not on the ground.
|
return null; // not on the ground.
|
||||||
|
|
||||||
return self.World.FindUnits(self.CenterPosition, self.CenterPosition)
|
return self.World.FindActorsInBox(self.CenterPosition, self.CenterPosition)
|
||||||
.FirstOrDefault( a => a.HasTrait<Reservable>() );
|
.FirstOrDefault( a => a.HasTrait<Reservable>() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ namespace OpenRA.Mods.RA
|
|||||||
case DamageModel.PerCell:
|
case DamageModel.PerCell:
|
||||||
{
|
{
|
||||||
foreach (var t in world.FindTilesInCircle(targetTile, warhead.Size[0]))
|
foreach (var t in world.FindTilesInCircle(targetTile, warhead.Size[0]))
|
||||||
foreach (var unit in world.FindUnits(t, t))
|
foreach (var unit in world.FindActorsInBox(t, t))
|
||||||
unit.InflictDamage(args.firedBy,
|
unit.InflictDamage(args.firedBy,
|
||||||
(int)(warhead.Damage * warhead.EffectivenessAgainst(unit)), warhead);
|
(int)(warhead.Damage * warhead.EffectivenessAgainst(unit)), warhead);
|
||||||
} break;
|
} break;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
|
|
||||||
public static IEnumerable<Actor> FindAliveCombatantActorsInBox(this World world, CPos a, CPos b)
|
public static IEnumerable<Actor> FindAliveCombatantActorsInBox(this World world, CPos a, CPos b)
|
||||||
{
|
{
|
||||||
return world.FindUnits(a, b)
|
return world.FindActorsInBox(a, b)
|
||||||
.Where(u => u.IsInWorld && u != world.WorldActor && !u.IsDead() && !u.Owner.NonCombatant);
|
.Where(u => u.IsInWorld && u != world.WorldActor && !u.IsDead() && !u.Owner.NonCombatant);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
|
|
||||||
if (baseTransferredTick == -1)
|
if (baseTransferredTick == -1)
|
||||||
{
|
{
|
||||||
var actorsInBase = world.FindUnits(alliedBaseTopLeft.Location, alliedBaseBottomRight.Location).Where(a => a != a.Owner.PlayerActor);
|
var actorsInBase = world.FindActorsInBox(alliedBaseTopLeft.Location, alliedBaseBottomRight.Location).Where(a => a != a.Owner.PlayerActor);
|
||||||
if (actorsInBase.Any(a => a.Owner == greece))
|
if (actorsInBase.Any(a => a.Owner == greece))
|
||||||
{
|
{
|
||||||
SetupAlliedBase(actorsInBase);
|
SetupAlliedBase(actorsInBase);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
if (!hasTicked)
|
if (!hasTicked)
|
||||||
{
|
{
|
||||||
var vec = new CVec(1, 1);
|
var vec = new CVec(1, 1);
|
||||||
var adjWalls = self.World.FindUnits(self.Location - vec, self.Location + vec)
|
var adjWalls = self.World.FindActorsInBox(self.Location - vec, self.Location + vec)
|
||||||
.Where(a => a.Info == self.Info && a != self);
|
.Where(a => a.Info == self.Info && a != self);
|
||||||
|
|
||||||
foreach (var w in adjWalls)
|
foreach (var w in adjWalls)
|
||||||
|
|||||||
Reference in New Issue
Block a user