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:
RoosterDragon
2015-10-24 22:57:02 +01:00
parent 7fbbaa2221
commit d0c23ef2dd

View File

@@ -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