Fix and enable SA1133, SA1134 style rules.

This commit is contained in:
Paul Chote
2019-05-23 18:43:21 +00:00
committed by abcdefg30
parent fbf9461890
commit 78a70be0d4
214 changed files with 1012 additions and 432 deletions

View File

@@ -49,7 +49,9 @@ namespace OpenRA
public class LocationInit : IActorInit<CPos>
{
[FieldFromYamlKey] readonly CPos value = CPos.Zero;
[FieldFromYamlKey]
readonly CPos value = CPos.Zero;
public LocationInit() { }
public LocationInit(CPos init) { value = init; }
public CPos Value(World world) { return value; }
@@ -57,7 +59,9 @@ namespace OpenRA
public class OwnerInit : IActorInit<Player>
{
[FieldFromYamlKey] public readonly string PlayerName = "Neutral";
[FieldFromYamlKey]
public readonly string PlayerName = "Neutral";
Player player;
public OwnerInit() { }

View File

@@ -21,7 +21,8 @@ namespace OpenRA.Network
{
public class GeoIP2Record
{
[MaxMind.Db.Constructor] public GeoIP2Record(GeoIP2Country country)
[Constructor]
public GeoIP2Record(GeoIP2Country country)
{
Country = country;
}
@@ -31,7 +32,8 @@ namespace OpenRA.Network
public class GeoIP2Country
{
[MaxMind.Db.Constructor] public GeoIP2Country(GeoIP2CountryNames names)
[Constructor]
public GeoIP2Country(GeoIP2CountryNames names)
{
Names = names;
}
@@ -41,7 +43,8 @@ namespace OpenRA.Network
public class GeoIP2CountryNames
{
[MaxMind.Db.Constructor] public GeoIP2CountryNames(string en)
[Constructor]
public GeoIP2CountryNames(string en)
{
English = en;
}

View File

@@ -46,7 +46,8 @@ namespace OpenRA.Network
public string Fingerprint;
public string AuthSignature;
[FieldLoader.Ignore] public Session.Client Client;
[FieldLoader.Ignore]
public Session.Client Client;
public static HandshakeResponse Deserialize(string data)
{

View File

@@ -20,7 +20,8 @@ namespace OpenRA.Traits
public class DebugPauseState : ISync
{
readonly World world;
[Sync] public bool Paused { get { return world.Paused; } }
[Sync]
public bool Paused { get { return world.Paused; } }
public DebugPauseState(World world) { this.world = world; }
}
}

View File

@@ -17,11 +17,13 @@ namespace OpenRA.Traits
[Desc("Add this to the World actor definition.")]
public class FixedColorPaletteInfo : ITraitInfo
{
[PaletteReference]
[Desc("The name of the palette to base off.")]
[PaletteReference] public readonly string Base = TileSet.TerrainPaletteInternalName;
public readonly string Base = TileSet.TerrainPaletteInternalName;
[PaletteDefinition]
[Desc("The name of the resulting palette")]
[PaletteDefinition] public readonly string Name = "resources";
public readonly string Name = "resources";
[Desc("Remap these indices to pre-defined colors.")]
public readonly int[] RemapIndex = { };

View File

@@ -204,8 +204,11 @@ namespace OpenRA.Traits
public class FrozenActorLayer : IRender, ITick, ISync
{
[Sync] public int VisibilityHash;
[Sync] public int FrozenHash;
[Sync]
public int VisibilityHash;
[Sync]
public int FrozenHash;
readonly int binSize;
readonly World world;

View File

@@ -19,11 +19,13 @@ namespace OpenRA.Traits
[Desc("Define a player palette by swapping palette indices.")]
public class IndexedPlayerPaletteInfo : ITraitInfo, IRulesetLoaded
{
[PaletteReference]
[Desc("The name of the palette to base off.")]
[PaletteReference] public readonly string BasePalette = null;
public readonly string BasePalette = null;
[PaletteDefinition(true)]
[Desc("The prefix for the resulting player palettes")]
[PaletteDefinition(true)] public readonly string BaseName = "player";
public readonly string BaseName = "player";
[Desc("Remap these indices to player colors.")]
public readonly int[] RemapIndex = { };

View File

@@ -17,11 +17,13 @@ namespace OpenRA.Traits
[Desc("Add this to the Player actor definition.")]
public class PlayerColorPaletteInfo : ITraitInfo
{
[PaletteReference]
[Desc("The name of the palette to base off.")]
[PaletteReference] public readonly string BasePalette = null;
public readonly string BasePalette = null;
[PaletteDefinition(true)]
[Desc("The prefix for the resulting player palettes")]
[PaletteDefinition(true)] public readonly string BaseName = "player";
public readonly string BaseName = "player";
[Desc("Remap these indices to player colors.")]
public readonly int[] RemapIndex = { };

View File

@@ -18,8 +18,9 @@ namespace OpenRA.Traits
[Desc("Add this to the Player actor definition.")]
public class PlayerHighlightPaletteInfo : ITraitInfo
{
[PaletteDefinition(true)]
[Desc("The prefix for the resulting player palettes")]
[PaletteDefinition(true)] public readonly string BaseName = "highlight";
public readonly string BaseName = "highlight";
public object Create(ActorInitializer init) { return new PlayerHighlightPalette(this); }
}

View File

@@ -102,7 +102,8 @@ namespace OpenRA.Traits
// Per-cell cache of the resolved cell type (shroud/fog/visible)
readonly CellLayer<ShroudCellType> resolvedType;
[Sync] bool disabled;
[Sync]
bool disabled;
public bool Disabled
{
get

View File

@@ -20,7 +20,8 @@ namespace OpenRA.Traits
+ "Defaults to the actor name when not defined or inherited.")]
public readonly string Class = null;
[VoiceReference] public readonly string Voice = "Select";
[VoiceReference]
public readonly string Voice = "Select";
public override object Create(ActorInitializer init) { return new Selectable(init.Self, this); }
}

View File

@@ -154,7 +154,8 @@ namespace OpenRA.Traits
Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued);
}
[Flags] public enum TargetModifiers { None = 0, ForceAttack = 1, ForceQueue = 2, ForceMove = 4 }
[Flags]
public enum TargetModifiers { None = 0, ForceAttack = 1, ForceQueue = 2, ForceMove = 4 }
public static class TargetModifiersExts
{