Convert cloak types to use BitSet

Fixes #15412
This commit is contained in:
Chris Forbes
2018-07-28 22:10:28 -07:00
committed by reaperrr
parent 1f71377d82
commit 67d9ad6a93
2 changed files with 7 additions and 3 deletions

View File

@@ -15,6 +15,7 @@ using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.Activities; using OpenRA.Activities;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Primitives;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits namespace OpenRA.Mods.Common.Traits
@@ -34,6 +35,9 @@ namespace OpenRA.Mods.Common.Traits
Dock = 256 Dock = 256
} }
// Type tag for cloaktypes
public class CloakType { }
[Desc("This unit can cloak and uncloak in specific situations.")] [Desc("This unit can cloak and uncloak in specific situations.")]
public class CloakInfo : ConditionalTraitInfo public class CloakInfo : ConditionalTraitInfo
{ {
@@ -53,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits
[PaletteReference("IsPlayerPalette")] public readonly string Palette = "cloak"; [PaletteReference("IsPlayerPalette")] public readonly string Palette = "cloak";
public readonly bool IsPlayerPalette = false; public readonly bool IsPlayerPalette = false;
public readonly HashSet<string> CloakTypes = new HashSet<string> { "Cloak" }; public readonly BitSet<CloakType> CloakTypes = new BitSet<CloakType>("Cloak");
[GrantedConditionReference] [GrantedConditionReference]
[Desc("The condition to grant to self while cloaked.")] [Desc("The condition to grant to self while cloaked.")]

View File

@@ -9,7 +9,7 @@
*/ */
#endregion #endregion
using System.Collections.Generic; using OpenRA.Primitives;
namespace OpenRA.Mods.Common.Traits namespace OpenRA.Mods.Common.Traits
{ {
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Traits
public class DetectCloakedInfo : ConditionalTraitInfo public class DetectCloakedInfo : ConditionalTraitInfo
{ {
[Desc("Specific cloak classifications I can reveal.")] [Desc("Specific cloak classifications I can reveal.")]
public readonly HashSet<string> CloakTypes = new HashSet<string> { "Cloak" }; public readonly BitSet<CloakType> CloakTypes = new BitSet<CloakType>("Cloak");
public readonly WDist Range = WDist.FromCells(5); public readonly WDist Range = WDist.FromCells(5);