Convert cloneabletypes to bitsets

Fixes #15411
This commit is contained in:
Chris Forbes
2018-07-28 22:03:20 -07:00
committed by reaperrr
parent 8634c001f9
commit 1f71377d82
2 changed files with 6 additions and 3 deletions

View File

@@ -9,7 +9,6 @@
*/ */
#endregion #endregion
using System.Collections.Generic;
using OpenRA.Mods.Common; using OpenRA.Mods.Common;
using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits;
using OpenRA.Primitives; using OpenRA.Primitives;
@@ -22,7 +21,7 @@ namespace OpenRA.Mods.Cnc.Traits
{ {
[FieldLoader.Require] [FieldLoader.Require]
[Desc("Uses the \"Cloneable\" trait to determine whether or not we should clone a produced unit.")] [Desc("Uses the \"Cloneable\" trait to determine whether or not we should clone a produced unit.")]
public readonly HashSet<string> CloneableTypes = new HashSet<string>(); public readonly BitSet<CloneableType> CloneableTypes = default(BitSet<CloneableType>);
public object Create(ActorInitializer init) { return new ClonesProducedUnits(init, this); } public object Create(ActorInitializer init) { return new ClonesProducedUnits(init, this); }
} }

View File

@@ -10,16 +10,20 @@
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using OpenRA.Primitives;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits namespace OpenRA.Mods.Cnc.Traits
{ {
// Type tag for CloneableTypes
public class CloneableType { }
[Desc("Actors with the \"ClonesProducedUnits\" trait will produce a free duplicate of me.")] [Desc("Actors with the \"ClonesProducedUnits\" trait will produce a free duplicate of me.")]
public class CloneableInfo : TraitInfo<Cloneable> public class CloneableInfo : TraitInfo<Cloneable>
{ {
[FieldLoader.Require] [FieldLoader.Require]
[Desc("This unit's cloneable type is:")] [Desc("This unit's cloneable type is:")]
public readonly HashSet<string> Types = new HashSet<string>(); public readonly BitSet<CloneableType> Types = default(BitSet<CloneableType>);
} }
public class Cloneable { } public class Cloneable { }