remove FP sillyness from FindUnits & friends

This commit is contained in:
Chris Forbes
2011-05-04 22:25:35 +12:00
parent ccc245ded4
commit 9b3e6c5c4a
10 changed files with 48 additions and 40 deletions

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA
public void TickIdle( Actor self )
{
var attack = self.Trait<AttackBase>();
var inRange = self.World.FindUnitsInCircle(self.CenterLocation, Game.CellSize * attack.GetMaximumRange());
var inRange = self.World.FindUnitsInCircle(self.CenterLocation, (int)(Game.CellSize * attack.GetMaximumRange()));
var target = inRange
.Where(a => a != self && a.AppearsFriendlyTo(self))

View File

@@ -95,7 +95,7 @@ namespace OpenRA.Mods.RA
nextScanTime = (int)(25 * (info.ScanTimeAverage +
(self.World.SharedRandom.NextDouble() * 2 - 1) * info.ScanTimeSpread));
var inRange = self.World.FindUnitsInCircle(self.CenterLocation, Game.CellSize * range);
var inRange = self.World.FindUnitsInCircle(self.CenterLocation, (int)(Game.CellSize * range));
return inRange
.Where(a => a.Owner != null && a.AppearsHostileTo(self))

View File

@@ -80,7 +80,7 @@ namespace OpenRA.Mods.RA
case DamageModel.Normal:
{
var maxSpread = warhead.Spread * (float)Math.Log(Math.Abs(warhead.Damage), 2);
var hitActors = world.FindUnitsInCircle(args.dest, maxSpread);
var hitActors = world.FindUnitsInCircle(args.dest, (int)maxSpread);
foreach (var victim in hitActors)
{
@@ -92,7 +92,7 @@ namespace OpenRA.Mods.RA
case DamageModel.PerCell:
{
foreach (var t in world.FindTilesInCircle(targetTile, warhead.Size[0]))
foreach (var unit in world.FindUnits(Game.CellSize * t, Game.CellSize * (t + new float2(1,1))))
foreach (var unit in world.FindUnits(Game.CellSize * t, Game.CellSize * (t + new int2(1,1))))
unit.InflictDamage(args.firedBy,
(int)(warhead.Damage * warhead.EffectivenessAgainst(unit)), warhead);
} break;

View File

@@ -56,7 +56,7 @@ namespace OpenRA.Mods.RA.Render
if (!hasTicked)
{
var oneCell = new float2(Game.CellSize, Game.CellSize);
var oneCell = new int2(Game.CellSize, Game.CellSize);
var adjWalls = self.World.FindUnits(self.CenterLocation - oneCell, self.CenterLocation + oneCell)
.Where(a => a.Info == self.Info && a != self);