Reuse TargetTypes collection in FrozenActor.RefreshState.

This commit is contained in:
RoosterDragon
2017-12-22 12:56:25 +00:00
committed by abcdefg30
parent b4609337f8
commit 3b642b1a79

View File

@@ -101,7 +101,10 @@ namespace OpenRA.Traits
public void RefreshState() public void RefreshState()
{ {
Owner = actor.Owner; Owner = actor.Owner;
TargetTypes = actor.GetEnabledTargetTypes().ToHashSet();
// PERF: Reuse collection to avoid allocations.
TargetTypes.Clear();
TargetTypes.UnionWith(actor.GetEnabledTargetTypes());
if (health != null) if (health != null)
{ {