diff --git a/OpenRA.Game/LocalPlayerProfile.cs b/OpenRA.Game/LocalPlayerProfile.cs index 4b6b64b4b3..17a20708ee 100644 --- a/OpenRA.Game/LocalPlayerProfile.cs +++ b/OpenRA.Game/LocalPlayerProfile.cs @@ -160,7 +160,7 @@ namespace OpenRA } innerState = LinkState.Uninitialized; - parameters = new RSAParameters(); + parameters = default(RSAParameters); innerFingerprint = null; innerData = null; } diff --git a/OpenRA.Game/MiniYaml.cs b/OpenRA.Game/MiniYaml.cs index f2de00ba91..31a6c46ceb 100644 --- a/OpenRA.Game/MiniYaml.cs +++ b/OpenRA.Game/MiniYaml.cs @@ -303,7 +303,7 @@ namespace OpenRA foreach (var kv in tree) { var inherited = new Dictionary(); - inherited.Add(kv.Key, new MiniYamlNode.SourceLocation()); + inherited.Add(kv.Key, default(MiniYamlNode.SourceLocation)); var children = ResolveInherits(kv.Key, kv.Value, tree, inherited); resolved.Add(kv.Key, new MiniYaml(kv.Value.Value, children)); diff --git a/OpenRA.Game/Primitives/Color.cs b/OpenRA.Game/Primitives/Color.cs index bb397f99de..6e9b24b16e 100644 --- a/OpenRA.Game/Primitives/Color.cs +++ b/OpenRA.Game/Primitives/Color.cs @@ -119,7 +119,7 @@ namespace OpenRA.Primitives public static bool TryParse(string value, out Color color) { - color = new Color(); + color = default(Color); value = value.Trim(); if (value.Length != 6 && value.Length != 8) return false; diff --git a/OpenRA.Game/Support/Log.cs b/OpenRA.Game/Support/Log.cs index 1581b275b5..41c07abbe0 100644 --- a/OpenRA.Game/Support/Log.cs +++ b/OpenRA.Game/Support/Log.cs @@ -52,7 +52,7 @@ namespace OpenRA if (string.IsNullOrEmpty(baseFilename)) { - Channels.Add(channelName, new ChannelInfo()); + Channels.Add(channelName, default(ChannelInfo)); return; } diff --git a/OpenRA.Game/Traits/Target.cs b/OpenRA.Game/Traits/Target.cs index 8d4f730cc3..8153b57183 100644 --- a/OpenRA.Game/Traits/Target.cs +++ b/OpenRA.Game/Traits/Target.cs @@ -19,7 +19,7 @@ namespace OpenRA.Traits public struct Target { public static readonly Target[] None = { }; - public static readonly Target Invalid = new Target(); + public static readonly Target Invalid = default(Target); readonly TargetType type; readonly Actor actor; diff --git a/OpenRA.Mods.Cnc/Graphics/Voxel.cs b/OpenRA.Mods.Cnc/Graphics/Voxel.cs index c1b374a0ba..986742a07e 100644 --- a/OpenRA.Mods.Cnc/Graphics/Voxel.cs +++ b/OpenRA.Mods.Cnc/Graphics/Voxel.cs @@ -48,7 +48,7 @@ namespace OpenRA.Mods.Cnc.Graphics for (var i = 0; i < vxl.LimbCount; i++) { var vl = vxl.Limbs[i]; - var l = new Limb(); + var l = default(Limb); l.Scale = vl.Scale; l.Bounds = (float[])vl.Bounds.Clone(); l.Size = (byte[])vl.Size.Clone(); diff --git a/OpenRA.Mods.Common/AudioLoaders/VocLoader.cs b/OpenRA.Mods.Common/AudioLoaders/VocLoader.cs index f75903029a..b683c64c48 100644 --- a/OpenRA.Mods.Common/AudioLoaders/VocLoader.cs +++ b/OpenRA.Mods.Common/AudioLoaders/VocLoader.cs @@ -148,7 +148,7 @@ namespace OpenRA.Mods.Common.AudioLoaders while (true) { - VocBlock block = new VocBlock(); + var block = default(VocBlock); try { block.Code = stream.ReadByte(); diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs index 745cc75589..dffe3b341f 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs @@ -100,7 +100,7 @@ namespace OpenRA.Mods.Common.Widgets editorLayer.Remove(underCursor); if (mapResources.Contains(cell) && mapResources[cell].Type != 0) - mapResources[cell] = new ResourceTile(); + mapResources[cell] = default(ResourceTile); } return true; diff --git a/OpenRA.Mods.Common/Traits/AppearsOnMapPreview.cs b/OpenRA.Mods.Common/Traits/AppearsOnMapPreview.cs index cc3ca64d19..9dc0c03799 100644 --- a/OpenRA.Mods.Common/Traits/AppearsOnMapPreview.cs +++ b/OpenRA.Mods.Common/Traits/AppearsOnMapPreview.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits public class AppearsOnMapPreviewInfo : TraitInfo, IMapPreviewSignatureInfo, Requires { [Desc("Use this color to render the actor, instead of owner player color.")] - public readonly Color Color = new Color(); + public readonly Color Color = default(Color); [Desc("Use this terrain color to render the actor, instead of owner player color.", "Overrides `Color` if both set.")] @@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits { color = tileSet[tileSet.GetTerrainIndex(Terrain)].Color; } - else if (Color != new Color()) + else if (Color != default(Color)) { color = Color; } diff --git a/OpenRA.Mods.Common/Traits/Render/WithTextControlGroupDecoration.cs b/OpenRA.Mods.Common/Traits/Render/WithTextControlGroupDecoration.cs index d5b543acf5..5105451b23 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithTextControlGroupDecoration.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithTextControlGroupDecoration.cs @@ -92,7 +92,7 @@ namespace OpenRA.Mods.Common.Traits.Render var halfSize = font.Measure(number) / 2; var boundsOffset = new int2(bounds.Left + bounds.Right, bounds.Top + bounds.Bottom) / 2; - var sizeOffset = new int2(); + var sizeOffset = int2.Zero; if (info.ReferencePoint.HasFlag(ReferencePoints.Top)) { boundsOffset -= new int2(0, bounds.Height / 2); diff --git a/OpenRA.Mods.Common/Traits/Render/WithTextDecoration.cs b/OpenRA.Mods.Common/Traits/Render/WithTextDecoration.cs index 3767b7bcfa..486fab93ee 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithTextDecoration.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithTextDecoration.cs @@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Traits.Render var halfSize = font.Measure(Info.Text) / 2; var boundsOffset = new int2(bounds.Left + bounds.Right, bounds.Top + bounds.Bottom) / 2; - var sizeOffset = new int2(); + var sizeOffset = int2.Zero; if (Info.ReferencePoint.HasFlag(ReferencePoints.Top)) { boundsOffset -= new int2(0, bounds.Height / 2); diff --git a/OpenRA.Mods.Common/Traits/World/ResourceLayer.cs b/OpenRA.Mods.Common/Traits/World/ResourceLayer.cs index 894d2fd706..815ee24b24 100644 --- a/OpenRA.Mods.Common/Traits/World/ResourceLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/ResourceLayer.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits public class ResourceLayer : IRenderOverlay, IWorldLoaded, ITickRender, INotifyActorDisposing { - static readonly CellContents EmptyCell = new CellContents(); + static readonly CellContents EmptyCell = default(CellContents); readonly World world; readonly BuildingInfluence buildingInfluence; @@ -310,7 +310,7 @@ namespace OpenRA.Mods.Common.Traits public struct CellContents { - public static readonly CellContents Empty = new CellContents(); + public static readonly CellContents Empty = default(CellContents); public ResourceType Type; public int Density; public string Variant; diff --git a/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs b/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs index 72b63c6b5e..b85a0714ce 100644 --- a/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs @@ -178,7 +178,7 @@ namespace OpenRA.Mods.Common.Traits if (!world.Map.Contains(loc)) return; - var tile = dirty.ContainsKey(loc) ? dirty[loc] : new Smudge(); + var tile = dirty.ContainsKey(loc) ? dirty[loc] : default(Smudge); // Setting Sprite to null to indicate a deleted smudge. tile.Sprite = null;