Move ctor initializers to their own line.

This commit is contained in:
Paul Chote
2019-06-08 12:59:02 +01:00
committed by reaperrr
parent 979ed1b140
commit 674155a8dd
33 changed files with 90 additions and 44 deletions

View File

@@ -34,7 +34,8 @@ namespace OpenRA
public byte Layer { get { return (byte)Bits; } }
public CPos(int bits) { Bits = bits; }
public CPos(int x, int y) : this(x, y, 0) { }
public CPos(int x, int y)
: this(x, y, 0) { }
public CPos(int x, int y, byte layer)
{
Bits = (x & 0xFFF) << 20 | (y & 0xFFF) << 8 | layer;

View File

@@ -40,7 +40,8 @@ namespace OpenRA
}
}
public MissingFieldsException(string[] missing, string header = null, string headerSingle = null) : base(null)
public MissingFieldsException(string[] missing, string header = null, string headerSingle = null)
: base(null)
{
Header = missing.Length > 1 ? header : headerSingle ?? header;
Missing = missing;

View File

@@ -28,7 +28,8 @@ namespace OpenRA
Lazy<TypeDictionary> initDict;
public ActorReference(string type) : this(type, new Dictionary<string, MiniYaml>()) { }
public ActorReference(string type)
: this(type, new Dictionary<string, MiniYaml>()) { }
public ActorReference(string type, Dictionary<string, MiniYaml> inits)
{

View File

@@ -19,7 +19,8 @@ namespace OpenRA
{
public readonly Dictionary<string, PlayerReference> Players;
public MapPlayers() : this(new List<MiniYamlNode>()) { }
public MapPlayers()
: this(new List<MiniYamlNode>()) { }
public MapPlayers(IEnumerable<MiniYamlNode> playerDefinitions)
{

View File

@@ -133,7 +133,8 @@ namespace OpenRA
return ret;
}
public MiniYaml(string value) : this(value, null) { }
public MiniYaml(string value)
: this(value, null) { }
public MiniYaml(string value, List<MiniYamlNode> nodes)
{
@@ -474,6 +475,7 @@ namespace OpenRA
[Serializable]
public class YamlException : Exception
{
public YamlException(string s) : base(s) { }
public YamlException(string s)
: base(s) { }
}
}

View File

@@ -84,7 +84,9 @@ namespace OpenRA.Primitives
{
readonly BitSetIndex bits;
public BitSet(params string[] values) : this(BitSetAllocator<T>.GetBits(values)) { }
public BitSet(params string[] values)
: this(BitSetAllocator<T>.GetBits(values)) { }
BitSet(BitSetIndex bits) { this.bits = bits; }
public static BitSet<T> FromStringsNoAlloc(string[] values)

View File

@@ -29,7 +29,8 @@ namespace OpenRA.Primitives
public event Action<IObservableCollection> OnRefresh = x => { };
public ObservableCollection() { }
public ObservableCollection(IList<T> list) : base(list) { }
public ObservableCollection(IList<T> list)
: base(list) { }
protected override void SetItem(int index, T item)
{

View File

@@ -28,9 +28,8 @@ namespace OpenRA.Primitives
readonly IComparer<T> comparer;
int level, index;
public PriorityQueue() : this(Comparer<T>.Default)
{
}
public PriorityQueue()
: this(Comparer<T>.Default) { }
public PriorityQueue(IComparer<T> comparer)
{

View File

@@ -22,7 +22,8 @@ namespace OpenRA.Support
public int Last;
public int TotalCount = 0;
public MersenneTwister() : this(Environment.TickCount) { }
public MersenneTwister()
: this(Environment.TickCount) { }
public MersenneTwister(int seed)
{

View File

@@ -561,7 +561,8 @@ namespace OpenRA.Support
public override string Symbol { get { return Name; } }
public VariableToken(int index, string symbol) : base(TokenType.Variable, index) { Name = symbol; }
public VariableToken(int index, string symbol)
: base(TokenType.Variable, index) { Name = symbol; }
}
class NumberToken : Token
@@ -957,7 +958,8 @@ namespace OpenRA.Support
{
readonly Func<IReadOnlyDictionary<string, int>, bool> asFunction;
public BooleanExpression(string expression) : base(expression)
public BooleanExpression(string expression)
: base(expression)
{
asFunction = Compile<bool>();
}
@@ -972,7 +974,8 @@ namespace OpenRA.Support
{
readonly Func<IReadOnlyDictionary<string, int>, int> asFunction;
public IntegerExpression(string expression) : base(expression)
public IntegerExpression(string expression)
: base(expression)
{
asFunction = Compile<int>();
}

View File

@@ -587,7 +587,8 @@ namespace OpenRA.Widgets
public class WidgetArgs : Dictionary<string, object>
{
public WidgetArgs() { }
public WidgetArgs(Dictionary<string, object> args) : base(args) { }
public WidgetArgs(Dictionary<string, object> args)
: base(args) { }
public void Add(string key, Action val) { base.Add(key, val); }
}
}

View File

@@ -22,7 +22,8 @@ namespace OpenRA.Mods.Cnc.Traits
public class TiberianSunRefinery : Refinery
{
public TiberianSunRefinery(Actor self, RefineryInfo info) : base(self, info) { }
public TiberianSunRefinery(Actor self, RefineryInfo info)
: base(self, info) { }
public override Activity DockSequence(Actor harv, Actor self)
{

View File

@@ -23,7 +23,8 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
class ImportRedAlertLegacyMapCommand : ImportLegacyMapCommand, IUtilityCommand
{
// TODO: 128x128 is probably not true for "mega maps" from the expansions.
public ImportRedAlertLegacyMapCommand() : base(128) { }
public ImportRedAlertLegacyMapCommand()
: base(128) { }
string IUtilityCommand.Name { get { return "--import-ra-map"; } }
bool IUtilityCommand.ValidateArguments(string[] args) { return ValidateArguments(args); }

View File

@@ -22,7 +22,8 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
class ImportTiberianDawnLegacyMapCommand : ImportLegacyMapCommand, IUtilityCommand
{
// NOTE: 64x64 map size is a C&C95 engine limitation
public ImportTiberianDawnLegacyMapCommand() : base(64) { }
public ImportTiberianDawnLegacyMapCommand()
: base(64) { }
string IUtilityCommand.Name { get { return "--import-td-map"; } }
bool IUtilityCommand.ValidateArguments(string[] args) { return ValidateArguments(args); }

View File

@@ -164,7 +164,8 @@ namespace OpenRA.Mods.Common.FileFormats
int baseOffset;
int index;
public AudStream(Stream stream, int outputSize, int dataSize) : base(stream)
public AudStream(Stream stream, int outputSize, int dataSize)
: base(stream)
{
this.outputSize = outputSize;
this.dataSize = dataSize;

View File

@@ -137,7 +137,8 @@ namespace OpenRA.Mods.Common.FileFormats
int outOffset;
int currentBlock;
public WavStream(Stream stream, int dataSize, short blockAlign, short channels, int uncompressedSize) : base(stream)
public WavStream(Stream stream, int dataSize, short blockAlign, short channels, int uncompressedSize)
: base(stream)
{
this.channels = channels;
numBlocks = dataSize / blockAlign;

View File

@@ -69,7 +69,8 @@ namespace OpenRA.Mods.Common.Orders
public class PowerDownOrderGenerator : GlobalButtonOrderGenerator<ToggleConditionOnOrder>
{
public PowerDownOrderGenerator() : base("PowerDown") { }
public PowerDownOrderGenerator()
: base("PowerDown") { }
protected override bool IsValidTrait(ToggleConditionOnOrder t)
{
@@ -85,7 +86,8 @@ namespace OpenRA.Mods.Common.Orders
public class SellOrderGenerator : GlobalButtonOrderGenerator<Sellable>
{
public SellOrderGenerator() : base("Sell") { }
public SellOrderGenerator()
: base("Sell") { }
protected override string GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi)
{

View File

@@ -21,7 +21,8 @@ namespace OpenRA.Mods.Common.Scripting
[ScriptGlobal("Actor")]
public class ActorGlobal : ScriptGlobal
{
public ActorGlobal(ScriptContext context) : base(context) { }
public ActorGlobal(ScriptContext context)
: base(context) { }
[Desc("Create a new actor. initTable specifies a list of key-value pairs that defines the initial parameters for the actor's traits.")]
public Actor Create(string type, bool addToWorld, LuaTable initTable)

View File

@@ -15,7 +15,8 @@ namespace OpenRA.Mods.Common.Scripting
[ScriptGlobal("CPos")]
public class CPosGlobal : ScriptGlobal
{
public CPosGlobal(ScriptContext context) : base(context) { }
public CPosGlobal(ScriptContext context)
: base(context) { }
[Desc("Create a new CPos with the specified coordinates.")]
public CPos New(int x, int y) { return new CPos(x, y); }
@@ -27,7 +28,8 @@ namespace OpenRA.Mods.Common.Scripting
[ScriptGlobal("CVec")]
public class CVecGlobal : ScriptGlobal
{
public CVecGlobal(ScriptContext context) : base(context) { }
public CVecGlobal(ScriptContext context)
: base(context) { }
[Desc("Create a new CVec with the specified coordinates.")]
public CVec New(int x, int y) { return new CVec(x, y); }
@@ -39,7 +41,8 @@ namespace OpenRA.Mods.Common.Scripting
[ScriptGlobal("WPos")]
public class WPosGlobal : ScriptGlobal
{
public WPosGlobal(ScriptContext context) : base(context) { }
public WPosGlobal(ScriptContext context)
: base(context) { }
[Desc("Create a new WPos with the specified coordinates.")]
public WPos New(int x, int y, int z) { return new WPos(x, y, z); }
@@ -51,7 +54,8 @@ namespace OpenRA.Mods.Common.Scripting
[ScriptGlobal("WVec")]
public class WVecGlobal : ScriptGlobal
{
public WVecGlobal(ScriptContext context) : base(context) { }
public WVecGlobal(ScriptContext context)
: base(context) { }
[Desc("Create a new WVec with the specified coordinates.")]
public WVec New(int x, int y, int z) { return new WVec(x, y, z); }
@@ -63,7 +67,8 @@ namespace OpenRA.Mods.Common.Scripting
[ScriptGlobal("WDist")]
public class WDistGlobal : ScriptGlobal
{
public WDistGlobal(ScriptContext context) : base(context) { }
public WDistGlobal(ScriptContext context)
: base(context) { }
[Desc("Create a new WDist.")]
public WDist New(int r) { return new WDist(r); }

View File

@@ -18,7 +18,8 @@ namespace OpenRA.Mods.Common.Scripting
[ScriptGlobal("Player")]
public class PlayerGlobal : ScriptGlobal
{
public PlayerGlobal(ScriptContext context) : base(context) { }
public PlayerGlobal(ScriptContext context)
: base(context) { }
[Desc("Returns the player with the specified internal name, or nil if a match is not found.")]
public Player GetPlayer(string name)

View File

@@ -20,7 +20,8 @@ namespace OpenRA.Mods.Common.Scripting
{
readonly RadarPings radarPings;
public RadarGlobal(ScriptContext context) : base(context)
public RadarGlobal(ScriptContext context)
: base(context)
{
radarPings = context.World.WorldActor.TraitOrDefault<RadarPings>();
}

View File

@@ -20,7 +20,8 @@ namespace OpenRA.Mods.Common.Scripting
[ScriptGlobal("Trigger")]
public class TriggerGlobal : ScriptGlobal
{
public TriggerGlobal(ScriptContext context) : base(context) { }
public TriggerGlobal(ScriptContext context)
: base(context) { }
public static ScriptTriggers GetScriptTriggers(Actor a)
{

View File

@@ -31,7 +31,8 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
internal Target Target;
internal StateMachine FuzzyStateMachine;
public Squad(IBot bot, SquadManagerBotModule squadManager, SquadType type) : this(bot, squadManager, type, null) { }
public Squad(IBot bot, SquadManagerBotModule squadManager, SquadType type)
: this(bot, squadManager, type, null) { }
public Squad(IBot bot, SquadManagerBotModule squadManager, SquadType type, Actor target)
{

View File

@@ -39,7 +39,8 @@ namespace OpenRA.Mods.Common.Traits
{
bool allowSpawn;
public FreeActor(ActorInitializer init, FreeActorInfo info) : base(info)
public FreeActor(ActorInitializer init, FreeActorInfo info)
: base(info)
{
allowSpawn = !init.Contains<FreeActorInit>() || init.Get<FreeActorInit>().ActorValue;
}

View File

@@ -41,7 +41,11 @@ namespace OpenRA.Mods.Common.Traits
[Sync]
public bool IsTraitPaused { get; private set; }
protected PausableConditionalTrait(InfoType info) : base(info) { IsTraitPaused = info.PausedByDefault; }
protected PausableConditionalTrait(InfoType info)
: base(info)
{
IsTraitPaused = info.PausedByDefault;
}
protected override void Created(Actor self)
{

View File

@@ -51,7 +51,8 @@ namespace OpenRA.Mods.Common.Traits
[Sync]
int damageThreshold;
public DamagedByTerrain(Actor self, DamagedByTerrainInfo info) : base(info)
public DamagedByTerrain(Actor self, DamagedByTerrainInfo info)
: base(info)
{
health = self.Trait<IHealth>();
}

View File

@@ -26,6 +26,7 @@ namespace OpenRA.Mods.Common.Traits
public class DetectCloaked : ConditionalTrait<DetectCloakedInfo>
{
public DetectCloaked(DetectCloakedInfo info) : base(info) { }
public DetectCloaked(DetectCloakedInfo info)
: base(info) { }
}
}

View File

@@ -39,6 +39,7 @@ namespace OpenRA.Mods.Common.Traits
public class RepairsUnits : PausableConditionalTrait<RepairsUnitsInfo>
{
public RepairsUnits(RepairsUnitsInfo info) : base(info) { }
public RepairsUnits(RepairsUnitsInfo info)
: base(info) { }
}
}

View File

@@ -42,7 +42,9 @@ namespace OpenRA.Mods.Common.Traits
public class SpawnActorPower : SupportPower
{
public SpawnActorPower(Actor self, SpawnActorPowerInfo info) : base(self, info) { }
public SpawnActorPower(Actor self, SpawnActorPowerInfo info)
: base(self, info) { }
public override void Activate(Actor self, Order order, SupportPowerManager manager)
{
base.Activate(self, order, manager);

View File

@@ -49,7 +49,8 @@ namespace OpenRA.Mods.Common.Traits
int spawnCountdown;
int actorsPresent;
public ActorSpawnManager(Actor self, ActorSpawnManagerInfo info) : base(info)
public ActorSpawnManager(Actor self, ActorSpawnManagerInfo info)
: base(info)
{
this.info = info;
}

View File

@@ -20,7 +20,8 @@ namespace OpenRA.Mods.Common.Widgets
Sprite hueSprite;
public HueSliderWidget() { }
public HueSliderWidget(HueSliderWidget other) : base(other) { }
public HueSliderWidget(HueSliderWidget other)
: base(other) { }
public override void Initialize(WidgetArgs args)
{

View File

@@ -16,7 +16,8 @@ namespace OpenRA.Mods.Common.Widgets
public class PasswordFieldWidget : TextFieldWidget
{
public PasswordFieldWidget() { }
protected PasswordFieldWidget(PasswordFieldWidget widget) : base(widget) { }
protected PasswordFieldWidget(PasswordFieldWidget widget)
: base(widget) { }
protected override string GetApparentText() { return new string('*', Text.Length); }
public override Widget Clone() { return new PasswordFieldWidget(this); }

View File

@@ -19,8 +19,11 @@ namespace OpenRA.Platforms.Default
{
class Sdl2HardwareCursorException : Exception
{
public Sdl2HardwareCursorException(string message) : base(message) { }
public Sdl2HardwareCursorException(string message, Exception innerException) : base(message, innerException) { }
public Sdl2HardwareCursorException(string message)
: base(message) { }
public Sdl2HardwareCursorException(string message, Exception innerException)
: base(message, innerException) { }
}
sealed class Sdl2HardwareCursor : IHardwareCursor