More HashSet trait fields & Lint support

This commit is contained in:
atlimit8
2015-09-05 15:54:00 -05:00
parent e74c0d6c13
commit 8250f223c4
57 changed files with 115 additions and 89 deletions

View File

@@ -22,8 +22,8 @@ namespace OpenRA.GameRules
public readonly Dictionary<string, string[]> Notifications = new Dictionary<string, string[]>();
public readonly string DefaultVariant = ".aud";
public readonly string DefaultPrefix = "";
public readonly string[] DisableVariants = { };
public readonly string[] DisablePrefixes = { };
public readonly HashSet<string> DisableVariants = new HashSet<string>();
public readonly HashSet<string> DisablePrefixes = new HashSet<string>();
public readonly Lazy<Dictionary<string, SoundPool>> VoicePools;
public readonly Lazy<Dictionary<string, SoundPool>> NotificationsPools;

View File

@@ -49,8 +49,8 @@ namespace OpenRA
static readonly TerrainTypeInfo Default = new TerrainTypeInfo();
public readonly string Type;
public readonly string[] TargetTypes = { };
public readonly string[] AcceptsSmudgeType = { };
public readonly HashSet<string> TargetTypes = new HashSet<string>();
public readonly HashSet<string> AcceptsSmudgeType = new HashSet<string>();
public readonly bool IsWater = false; // TODO: Remove this
public readonly Color Color;
public readonly string CustomCursor;

View File

@@ -8,12 +8,14 @@
*/
#endregion
using System.Collections.Generic;
namespace OpenRA.Traits
{
public class EditorTilesetFilterInfo : TraitInfo<EditorTilesetFilter>
{
public readonly string[] RequireTilesets = null;
public readonly string[] ExcludeTilesets = null;
public readonly HashSet<string> RequireTilesets = null;
public readonly HashSet<string> ExcludeTilesets = null;
}
public class EditorTilesetFilter { }

View File

@@ -8,6 +8,7 @@
*/
#endregion
using System.Collections.Generic;
using System.Linq;
namespace OpenRA.Traits
@@ -16,14 +17,14 @@ namespace OpenRA.Traits
public class RejectsOrdersInfo : ITraitInfo
{
[Desc("Possible values include Attack, AttackMove, Guard, Move.")]
public readonly string[] Except = { };
public readonly HashSet<string> Except = new HashSet<string>();
public object Create(ActorInitializer init) { return new RejectsOrders(this); }
}
public class RejectsOrders
{
public string[] Except { get { return info.Except; } }
public HashSet<string> Except { get { return info.Except; } }
readonly RejectsOrdersInfo info;

View File

@@ -268,7 +268,7 @@ namespace OpenRA.Traits
{
void OnCrush(Actor crusher);
void WarnCrush(Actor crusher);
bool CrushableBy(string[] crushClasses, Player owner);
bool CrushableBy(HashSet<string> crushClasses, Player owner);
}
public interface ITraitInfo { object Create(ActorInitializer init); }

View File

@@ -8,6 +8,8 @@
*/
#endregion
using System.Collections.Generic;
namespace OpenRA.Traits
{
[Desc("Attach this to the `World` actor.")]
@@ -20,7 +22,7 @@ namespace OpenRA.Traits
public readonly string InternalName = null;
[Desc("Pick a random faction as the player's facton out of this list.")]
public readonly string[] RandomFactionMembers = { };
public readonly HashSet<string> RandomFactionMembers = new HashSet<string>();
[Desc("The side that the faction belongs to. For example, England belongs to the 'Allies' side.")]
public readonly string Side = null;

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Traits
public readonly string Name = null;
public readonly string TerrainType = "Ore";
public readonly string[] AllowedTerrainTypes = { };
public readonly HashSet<string> AllowedTerrainTypes = new HashSet<string>();
public readonly bool AllowUnderActors = false;
public readonly bool AllowUnderBuildings = false;
public readonly bool AllowOnRamps = false;