Skip to content

Commit

Permalink
Convert cloak types to use BitSet
Browse files Browse the repository at this point in the history
Fixes #15412
  • Loading branch information
chrisforbes committed Jul 29, 2018
1 parent 2ea68cc commit 5672fdc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion OpenRA.Mods.Common/Traits/Cloak.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using System.Linq;
using OpenRA.Activities;
using OpenRA.Graphics;
using OpenRA.Primitives;
using OpenRA.Traits;

namespace OpenRA.Mods.Common.Traits
Expand All @@ -34,6 +35,9 @@ public enum UncloakType
Dock = 256
}

// Type tag for cloaktypes
public class CloakType { }

[Desc("This unit can cloak and uncloak in specific situations.")]
public class CloakInfo : ConditionalTraitInfo
{
Expand All @@ -53,7 +57,7 @@ public class CloakInfo : ConditionalTraitInfo
[PaletteReference("IsPlayerPalette")] public readonly string Palette = "cloak";
public readonly bool IsPlayerPalette = false;

public readonly HashSet<string> CloakTypes = new HashSet<string> { "Cloak" };
public readonly BitSet<CloakType> CloakTypes = default(BitSet<CloakType>);

[GrantedConditionReference]
[Desc("The condition to grant to self while cloaked.")]
Expand Down
4 changes: 2 additions & 2 deletions OpenRA.Mods.Common/Traits/DetectCloaked.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
*/
#endregion

using System.Collections.Generic;
using OpenRA.Primitives;

namespace OpenRA.Mods.Common.Traits
{
[Desc("Actor can reveal Cloak actors in a specified range.")]
public class DetectCloakedInfo : ConditionalTraitInfo
{
[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);

Expand Down

0 comments on commit 5672fdc

Please sign in to comment.