Replace some .Any checks with explicit .Count checks in AI

This commit is contained in:
reaperrr
2017-12-02 04:18:42 +01:00
committed by Paul Chote
parent 3fe808e0fb
commit e6835cef6e
3 changed files with 3 additions and 3 deletions

View File

@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.AI
var enemyUnits = owner.World.FindActorsInCircle(owner.TargetActor.CenterPosition, WDist.FromCells(owner.Bot.Info.IdleScanRadius))
.Where(unit => owner.Bot.Player.Stances[unit.Owner] == Stance.Enemy).ToList();
if (!enemyUnits.Any())
if (enemyUnits.Count == 0)
return;
if (AttackOrFleeFuzzy.Default.CanAttack(owner.Units, enemyUnits))

View File

@@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.AI
var enemyUnits = owner.World.FindActorsInCircle(owner.TargetActor.CenterPosition, WDist.FromCells(owner.Bot.Info.IdleScanRadius))
.Where(unit => owner.Bot.Player.Stances[unit.Owner] == Stance.Enemy).ToList();
if (!enemyUnits.Any())
if (enemyUnits.Count == 0)
return;
if (AttackOrFleeFuzzy.Default.CanAttack(owner.Units, enemyUnits))

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.AI
var location = squad.Bot.GetRandomBaseCenter();
var buildings = squad.World.ActorsHavingTrait<Building>()
.Where(a => a.Owner == squad.Bot.Player).ToList();
if (buildings.Any())
if (buildings.Count > 0)
location = buildings.Random(squad.Random).Location;
return location;