Prevent redundant enumerations in Attack.InnerTick.
The armaments variable is enumerated several times, but the results won't change. If we cache it straight away we can improve performance.
This commit is contained in:
@@ -68,8 +68,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
return NextActivity;
|
||||
|
||||
// Drop the target once none of the weapons are effective against it
|
||||
var armaments = attack.ChooseArmamentsForTarget(Target, forceAttack);
|
||||
if (!armaments.Any())
|
||||
var armaments = attack.ChooseArmamentsForTarget(Target, forceAttack).ToList();
|
||||
if (armaments.Count == 0)
|
||||
return NextActivity;
|
||||
|
||||
// Update ranges
|
||||
|
||||
Reference in New Issue
Block a user