Replace arrays with sets.

In places where arrays were being treated as a set, just create a set directly. This reveals the intention of such collections better, and also improves performance by allowing set based methods to be used.
This commit is contained in:
RoosterDragon
2015-09-03 20:09:16 +01:00
parent 4f4bab2cdf
commit 901e604cf3
19 changed files with 43 additions and 38 deletions

View File

@@ -17,8 +17,8 @@ namespace OpenRA.Mods.Common.Traits
public class TargetableInfo : UpgradableTraitInfo, ITargetableInfo
{
[Desc("Target type. Used for filtering (in)valid targets.")]
public readonly string[] TargetTypes = { };
public string[] GetTargetTypes() { return TargetTypes; }
public readonly HashSet<string> TargetTypes = new HashSet<string>();
public HashSet<string> GetTargetTypes() { return TargetTypes; }
public bool RequiresForceFire = false;
@@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Traits
return cloak.IsVisible(self, viewer.Owner);
}
public virtual string[] TargetTypes { get { return Info.TargetTypes; } }
public virtual HashSet<string> TargetTypes { get { return Info.TargetTypes; } }
public bool RequiresForceFire { get { return Info.RequiresForceFire; } }
}