Minor changes to reduce allocation.

- Cache a predicate in ActorMap.
- Use short circuiting to skip a call to HasTrait in AttackBase.
- In AutoTarget.ScanForTarget, move the check for the scan time above the calculations since we can skip them if it's not time yet.
- In AutoTarget.ChooseTarget, merge four Where calls into one.
This commit is contained in:
RoosterDragon
2014-06-12 04:04:39 +01:00
parent e0c59511fb
commit b8b8b1e2df
3 changed files with 16 additions and 9 deletions

View File

@@ -157,7 +157,7 @@ namespace OpenRA.Mods.RA
public bool IsReachableTarget(Target target, bool allowMove)
{
return HasAnyValidWeapons(target)
&& (target.IsInRange(self.CenterPosition, GetMaximumRange()) || (self.HasTrait<IMove>() && allowMove));
&& (target.IsInRange(self.CenterPosition, GetMaximumRange()) || (allowMove && self.HasTrait<IMove>()));
}
class AttackOrderTargeter : IOrderTargeter