Cache FrozenActor ITargetable.TargetTypes union

This commit is contained in:
atlimit8
2015-07-16 11:47:16 -05:00
parent 6986cd9f0e
commit fadfd179cb
5 changed files with 10 additions and 10 deletions

View File

@@ -82,7 +82,7 @@ namespace OpenRA.Mods.Common.Orders
public override bool CanTargetFrozenActor(Actor self, FrozenActor target, TargetModifiers modifiers, ref string cursor)
{
return target.Info.Traits.WithInterface<ITargetableInfo>().Any(t => t.GetTargetTypes().Intersect(targetTypes).Any());
return target.TargetTypes.Intersect(targetTypes).Any();
}
}
}

View File

@@ -75,8 +75,7 @@ namespace OpenRA.Mods.Common.Warheads
return false;
// A target type is valid if it is in the valid targets list, and not in the invalid targets list.
var targetable = victim.Info.Traits.WithInterface<ITargetableInfo>();
if (!IsValidTarget(targetable.SelectMany(t => t.GetTargetTypes())))
if (!IsValidTarget(victim.TargetTypes))
return false;
return true;