Remove PPos overload of FindUnits.
This commit is contained in:
@@ -74,8 +74,8 @@ namespace OpenRA.Graphics
|
||||
var comparer = new RenderableComparer(this);
|
||||
|
||||
var actors = world.FindUnits(
|
||||
bounds.TopLeftAsCPos().ToPPos(),
|
||||
bounds.BottomRightAsCPos().ToPPos());
|
||||
bounds.TopLeftAsCPos(),
|
||||
bounds.BottomRightAsCPos());
|
||||
|
||||
var worldRenderables = actors.SelectMany(a => a.Render(this))
|
||||
.OrderBy(r => r, comparer);
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace OpenRA.Widgets
|
||||
static readonly Actor[] NoActors = {};
|
||||
IEnumerable<Actor> SelectActorsInBox(World world, PPos a, PPos b, Func<Actor, bool> cond)
|
||||
{
|
||||
return world.FindUnits(a, b)
|
||||
return world.FindUnits(a.ToWPos(0), b.ToWPos(0))
|
||||
.Where(x => x.HasTrait<Selectable>() && x.Trait<Selectable>().Info.Selectable && !world.FogObscures(x) && cond(x))
|
||||
.GroupBy(x => x.GetSelectionPriority())
|
||||
.OrderByDescending(g => g.Key)
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace OpenRA
|
||||
{
|
||||
public static IEnumerable<Actor> FindUnitsAtMouse(this World world, int2 mouseLocation)
|
||||
{
|
||||
var loc = Game.viewport.ViewToWorldPx(mouseLocation);
|
||||
var loc = Game.viewport.ViewToWorldPx(mouseLocation).ToWPos(0);
|
||||
return FindUnits(world, loc, loc).Where(a => !world.FogObscures(a));
|
||||
}
|
||||
|
||||
@@ -34,11 +34,8 @@ namespace OpenRA
|
||||
|
||||
public static IEnumerable<Actor> FindUnits(this World world, WPos tl, WPos br)
|
||||
{
|
||||
return world.FindUnits(PPos.FromWPos(tl), PPos.FromWPos(br));
|
||||
}
|
||||
|
||||
public static IEnumerable<Actor> FindUnits(this World world, PPos a, PPos b)
|
||||
{
|
||||
var a = PPos.FromWPos(tl);
|
||||
var b = PPos.FromWPos(br);
|
||||
var u = PPos.Min(a, b);
|
||||
var v = PPos.Max(a, b);
|
||||
return world.WorldActor.Trait<SpatialBins>().ActorsInBox(u,v);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
{
|
||||
if (!limitedAmmo.GiveAmmo()) return NextActivity;
|
||||
|
||||
var hostBuilding = self.World.FindUnits(self.CenterLocation, self.CenterLocation)
|
||||
var hostBuilding = self.World.FindUnits(self.CenterPosition, self.CenterPosition)
|
||||
.FirstOrDefault(a => a.HasTrait<RenderBuilding>());
|
||||
|
||||
if (hostBuilding != null)
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace OpenRA.Mods.RA.Air
|
||||
if (self.Trait<IMove>().Altitude != 0)
|
||||
return null; // not on the ground.
|
||||
|
||||
return self.World.FindUnits(self.CenterLocation, self.CenterLocation)
|
||||
return self.World.FindUnits(self.CenterPosition, self.CenterPosition)
|
||||
.FirstOrDefault( a => a.HasTrait<Reservable>() );
|
||||
}
|
||||
|
||||
|
||||
@@ -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.ToPPos(), (t + new CVec(1,1)).ToPPos()))
|
||||
foreach (var unit in world.FindUnits(t, t))
|
||||
unit.InflictDamage(args.firedBy,
|
||||
(int)(warhead.Damage * warhead.EffectivenessAgainst(unit)), warhead);
|
||||
} break;
|
||||
|
||||
@@ -47,7 +47,8 @@ namespace OpenRA.Mods.RA.Render
|
||||
|
||||
if (!hasTicked)
|
||||
{
|
||||
var adjWalls = self.World.FindUnits(self.CenterLocation - PVecInt.OneCell, self.CenterLocation + PVecInt.OneCell)
|
||||
var vec = new CVec(1, 1);
|
||||
var adjWalls = self.World.FindUnits(self.Location - vec, self.Location + vec)
|
||||
.Where(a => a.Info == self.Info && a != self);
|
||||
|
||||
foreach (var w in adjWalls)
|
||||
|
||||
Reference in New Issue
Block a user