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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user