fix comparing with null
This commit is contained in:
committed by
Matthias Mailänder
parent
f6d4b860ee
commit
b1afeb4408
@@ -184,7 +184,6 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
int y = 0;
|
int y = 0;
|
||||||
int countUnits = 0;
|
int countUnits = 0;
|
||||||
foreach (var u in units)
|
foreach (var u in units)
|
||||||
if (u.Location != null)
|
|
||||||
{
|
{
|
||||||
x += u.Location.X;
|
x += u.Location.X;
|
||||||
y += u.Location.Y;
|
y += u.Location.Y;
|
||||||
@@ -915,7 +914,6 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
Func<PPos, CPos, CPos?> findPos = (PPos pos, CPos center) =>
|
Func<PPos, CPos, CPos?> findPos = (PPos pos, CPos center) =>
|
||||||
{
|
{
|
||||||
for (var k = MaxBaseDistance; k >= 0; k--)
|
for (var k = MaxBaseDistance; k >= 0; k--)
|
||||||
if (pos != null)
|
|
||||||
{
|
{
|
||||||
var tlist = world.FindTilesInCircle(center, k)
|
var tlist = world.FindTilesInCircle(center, k)
|
||||||
.OrderBy(a => (new PPos(a.ToPPos().X, a.ToPPos().Y) - pos).LengthSquared);
|
.OrderBy(a => (new PPos(a.ToPPos().X, a.ToPPos().Y) - pos).LengthSquared);
|
||||||
@@ -1003,7 +1001,7 @@ namespace OpenRA.Mods.RA.AI
|
|||||||
.Where(a => a.Owner == enemy && a.HasTrait<IOccupySpace>());
|
.Where(a => a.Owner == enemy && a.HasTrait<IOccupySpace>());
|
||||||
Actor target = null;
|
Actor target = null;
|
||||||
|
|
||||||
if (targets.Any() && baseCenter != null)
|
if (targets.Any())
|
||||||
target = targets.ClosestTo(baseCenter.ToPPos());
|
target = targets.ClosestTo(baseCenter.ToPPos());
|
||||||
|
|
||||||
if (target == null)
|
if (target == null)
|
||||||
|
|||||||
Reference in New Issue
Block a user