From 27f04c1b78e4ffc45c4fc9806b3454b4f3844b8d Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 20 Jul 2013 14:03:35 +1200 Subject: [PATCH] Rename FindUnits -> FindActorsInBox. --- OpenRA.Game/Graphics/WorldRenderer.cs | 2 +- .../Widgets/WorldInteractionControllerWidget.cs | 2 +- OpenRA.Game/WorldUtils.cs | 10 +++++----- OpenRA.Mods.RA/Activities/Rearm.cs | 2 +- OpenRA.Mods.RA/Air/Aircraft.cs | 2 +- OpenRA.Mods.RA/Combat.cs | 2 +- OpenRA.Mods.RA/Missions/MissionUtils.cs | 2 +- OpenRA.Mods.RA/Missions/MonsterTankMadnessScript.cs | 2 +- OpenRA.Mods.RA/Render/RenderBuildingWall.cs | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/OpenRA.Game/Graphics/WorldRenderer.cs b/OpenRA.Game/Graphics/WorldRenderer.cs index 74a153c484..d01d7e963c 100644 --- a/OpenRA.Game/Graphics/WorldRenderer.cs +++ b/OpenRA.Game/Graphics/WorldRenderer.cs @@ -73,7 +73,7 @@ namespace OpenRA.Graphics var bounds = Game.viewport.WorldBounds(world); var comparer = new RenderableComparer(this); - var actors = world.FindUnits( + var actors = world.FindActorsInBox( bounds.TopLeftAsCPos(), bounds.BottomRightAsCPos()); diff --git a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs index 2ca5420220..e0689c669d 100644 --- a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs @@ -185,7 +185,7 @@ namespace OpenRA.Widgets static readonly Actor[] NoActors = {}; IEnumerable SelectActorsInBox(World world, PPos a, PPos b, Func cond) { - return world.FindUnits(a.ToWPos(0), b.ToWPos(0)) + return world.FindActorsInBox(a.ToWPos(0), b.ToWPos(0)) .Where(x => x.HasTrait() && x.Trait().Info.Selectable && !world.FogObscures(x) && cond(x)) .GroupBy(x => x.GetSelectionPriority()) .OrderByDescending(g => g.Key) diff --git a/OpenRA.Game/WorldUtils.cs b/OpenRA.Game/WorldUtils.cs index 02a14770a2..9dcc5e838a 100755 --- a/OpenRA.Game/WorldUtils.cs +++ b/OpenRA.Game/WorldUtils.cs @@ -24,15 +24,15 @@ namespace OpenRA public static IEnumerable FindUnitsAtMouse(this World world, int2 mouseLocation) { 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 FindUnits(this World world, CPos tl, CPos br) + public static IEnumerable 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 FindUnits(this World world, WPos tl, WPos br) + public static IEnumerable FindActorsInBox(this World world, WPos tl, WPos br) { var a = PPos.FromWPos(tl); var b = PPos.FromWPos(br); @@ -59,7 +59,7 @@ namespace OpenRA // Target ranges are calculated in 2D, so ignore height differences var vec = new WVec(r, r, WRange.Zero); 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 dx = (long)(pos.X - origin.X); diff --git a/OpenRA.Mods.RA/Activities/Rearm.cs b/OpenRA.Mods.RA/Activities/Rearm.cs index e2fc44356b..a930e46409 100644 --- a/OpenRA.Mods.RA/Activities/Rearm.cs +++ b/OpenRA.Mods.RA/Activities/Rearm.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Activities { 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()); if (hostBuilding != null) diff --git a/OpenRA.Mods.RA/Air/Aircraft.cs b/OpenRA.Mods.RA/Air/Aircraft.cs index 935ea85104..7c8f0f8feb 100755 --- a/OpenRA.Mods.RA/Air/Aircraft.cs +++ b/OpenRA.Mods.RA/Air/Aircraft.cs @@ -80,7 +80,7 @@ namespace OpenRA.Mods.RA.Air if (self.Trait().Altitude != 0) 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() ); } diff --git a/OpenRA.Mods.RA/Combat.cs b/OpenRA.Mods.RA/Combat.cs index aa6b4b2c11..6144d190a6 100755 --- a/OpenRA.Mods.RA/Combat.cs +++ b/OpenRA.Mods.RA/Combat.cs @@ -118,7 +118,7 @@ namespace OpenRA.Mods.RA case DamageModel.PerCell: { 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, (int)(warhead.Damage * warhead.EffectivenessAgainst(unit)), warhead); } break; diff --git a/OpenRA.Mods.RA/Missions/MissionUtils.cs b/OpenRA.Mods.RA/Missions/MissionUtils.cs index dee5e51339..e397de1dad 100644 --- a/OpenRA.Mods.RA/Missions/MissionUtils.cs +++ b/OpenRA.Mods.RA/Missions/MissionUtils.cs @@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA.Missions public static IEnumerable 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); } diff --git a/OpenRA.Mods.RA/Missions/MonsterTankMadnessScript.cs b/OpenRA.Mods.RA/Missions/MonsterTankMadnessScript.cs index 899efb3064..6b4da0cd2d 100644 --- a/OpenRA.Mods.RA/Missions/MonsterTankMadnessScript.cs +++ b/OpenRA.Mods.RA/Missions/MonsterTankMadnessScript.cs @@ -129,7 +129,7 @@ namespace OpenRA.Mods.RA.Missions 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)) { SetupAlliedBase(actorsInBase); diff --git a/OpenRA.Mods.RA/Render/RenderBuildingWall.cs b/OpenRA.Mods.RA/Render/RenderBuildingWall.cs index 747fe68ae9..6b0c4b7638 100644 --- a/OpenRA.Mods.RA/Render/RenderBuildingWall.cs +++ b/OpenRA.Mods.RA/Render/RenderBuildingWall.cs @@ -48,7 +48,7 @@ namespace OpenRA.Mods.RA.Render if (!hasTicked) { 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); foreach (var w in adjWalls)