Remove explicit List<Actors> everywhere.

This commit is contained in:
Paul Chote
2013-08-24 10:44:18 +12:00
parent 5d142945eb
commit ea1b5fc89d
3 changed files with 15 additions and 14 deletions

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA.AI
{
protected const int missileUnitsMultiplier = 3;
protected static int CountAntiAirUnits(List<Actor> units)
protected static int CountAntiAirUnits(IEnumerable<Actor> units)
{
int missileUnitsCount = 0;
foreach (var unit in units)
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA.AI
return base.MayBeFlee(owner, (enemyAroundUnit) =>
{
int missileUnitsCount = 0;
if (enemyAroundUnit.Count > 0)
if (enemyAroundUnit.Any())
missileUnitsCount = CountAntiAirUnits(enemyAroundUnit);
if (missileUnitsCount * missileUnitsMultiplier > owner.units.Count)

View File

@@ -92,7 +92,7 @@ namespace OpenRA.Mods.RA.AI
return false;
}
protected virtual bool MayBeFlee(Squad squad, Func<List<Actor>, bool> flee)
protected virtual bool MayBeFlee(Squad squad, Func<IEnumerable<Actor>, bool> flee)
{
if (!squad.IsValid)
return false;
@@ -107,7 +107,7 @@ namespace OpenRA.Mods.RA.AI
if (!enemyAroundUnit.Any())
return false;
return flee(enemyAroundUnit.ToList());
return flee(enemyAroundUnit);
}
}
}