Fix CA1851
This commit is contained in:
@@ -358,14 +358,11 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
|
||||
bool IsValidTarget(CPos xy)
|
||||
{
|
||||
// Don't teleport if there are no units in range (either all moved out of range, or none yet moved into range)
|
||||
var unitsInRange = power.UnitsInRange(sourceLocation);
|
||||
if (!unitsInRange.Any())
|
||||
return false;
|
||||
|
||||
var canTeleport = false;
|
||||
foreach (var unit in unitsInRange)
|
||||
var anyUnitsInRange = false;
|
||||
foreach (var unit in power.UnitsInRange(sourceLocation))
|
||||
{
|
||||
anyUnitsInRange = true;
|
||||
var targetCell = unit.Location + (xy - sourceLocation);
|
||||
if (manager.Self.Owner.Shroud.IsExplored(targetCell) && unit.Trait<Chronoshiftable>().CanChronoshiftTo(unit, targetCell))
|
||||
{
|
||||
@@ -374,6 +371,10 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
}
|
||||
}
|
||||
|
||||
// Don't teleport if there are no units in range (either all moved out of range, or none yet moved into range)
|
||||
if (!anyUnitsInRange)
|
||||
return false;
|
||||
|
||||
if (!canTeleport)
|
||||
{
|
||||
// Check the terrain types. This will allow chronoshifts to occur on empty terrain to terrain of
|
||||
|
||||
Reference in New Issue
Block a user