From 7eb64ea6fc04b692f38e2ce89c8d121ce9ab4b44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20C=C3=A1ceres?= Date: Mon, 2 May 2022 13:06:21 +0200 Subject: [PATCH] Use read-only autoimplemented property when possible --- OpenRA.Game/Actor.cs | 8 +++---- OpenRA.Game/FileFormats/Png.cs | 10 ++++----- OpenRA.Game/FileSystem/ZipFile.cs | 2 +- OpenRA.Game/GameInformation.cs | 2 +- OpenRA.Game/Graphics/HardwarePalette.cs | 4 ++-- OpenRA.Game/Graphics/SpriteFont.cs | 2 +- OpenRA.Game/Graphics/WorldRenderer.cs | 2 +- OpenRA.Game/Map/MapGrid.cs | 2 +- OpenRA.Game/ModData.cs | 4 ++-- OpenRA.Game/Network/OrderManager.cs | 2 +- OpenRA.Game/Player.cs | 2 +- OpenRA.Game/Renderer.cs | 22 +++++++++---------- OpenRA.Game/Scripting/ScriptContext.cs | 4 ++-- OpenRA.Game/Sound/Sound.cs | 2 +- OpenRA.Game/Support/Benchmark.cs | 4 ++-- OpenRA.Game/World.cs | 2 +- OpenRA.Mods.Cnc/FileSystem/BigFile.cs | 2 +- OpenRA.Mods.Cnc/FileSystem/MixFile.cs | 2 +- OpenRA.Mods.Cnc/FileSystem/Pak.cs | 2 +- OpenRA.Mods.Cnc/SpriteLoaders/ShpD2Loader.cs | 2 +- .../SpriteLoaders/ShpRemasteredLoader.cs | 2 +- OpenRA.Mods.Cnc/SpriteLoaders/ShpTDLoader.cs | 2 +- OpenRA.Mods.Cnc/SpriteLoaders/TmpRALoader.cs | 4 ++-- OpenRA.Mods.Cnc/SpriteLoaders/TmpTDLoader.cs | 4 ++-- OpenRA.Mods.Cnc/SpriteLoaders/TmpTSLoader.cs | 4 ++-- OpenRA.Mods.Common/Commands/ChatCommands.cs | 2 +- .../EditorBrushes/EditorCopyPasteBrush.cs | 10 ++++----- .../EditorBrushes/EditorDefaultBrush.cs | 4 ++-- .../EditorBrushes/EditorTileBrush.cs | 10 ++++----- OpenRA.Mods.Common/FileFormats/IniFile.cs | 2 +- .../FileSystem/InstallShieldPackage.cs | 2 +- .../Graphics/DefaultSpriteSequence.cs | 18 +++++++-------- .../Orders/DeployOrderTargeter.cs | 4 ++-- .../Orders/UnitOrderTargeter.cs | 4 ++-- OpenRA.Mods.Common/SpriteLoaders/DdsLoader.cs | 8 +++---- .../SpriteLoaders/ShpTSLoader.cs | 6 ++--- OpenRA.Mods.Common/SpriteLoaders/TgaLoader.cs | 12 +++++----- .../Traits/Attack/AttackBase.cs | 2 +- .../Traits/Buildings/Building.cs | 2 +- OpenRA.Mods.Common/Traits/Health.cs | 2 +- .../Traits/Player/ProductionQueue.cs | 2 +- OpenRA.Mods.Common/Traits/Production.cs | 2 +- .../SupportPowers/SelectDirectionalTarget.cs | 6 ++--- OpenRA.Mods.Common/Traits/World/ActorMap.cs | 4 ++-- .../Traits/World/ControlGroups.cs | 2 +- .../Traits/World/EditorActionManager.cs | 6 ++--- .../Traits/World/EditorActorPreview.cs | 2 +- .../Widgets/Logic/Editor/ActorEditLogic.cs | 2 +- OpenRA.Mods.Common/Widgets/RadarWidget.cs | 4 ++-- .../PackageLoaders/D2kSoundResources.cs | 2 +- OpenRA.Mods.D2k/SpriteLoaders/R8Loader.cs | 6 ++--- OpenRA.Platforms.Default/OpenAlSoundEngine.cs | 2 +- 52 files changed, 113 insertions(+), 113 deletions(-) diff --git a/OpenRA.Game/Actor.cs b/OpenRA.Game/Actor.cs index c447d35210..8b6dfcf4ac 100644 --- a/OpenRA.Game/Actor.cs +++ b/OpenRA.Game/Actor.cs @@ -65,9 +65,9 @@ namespace OpenRA public int Generation; public Actor ReplacedByActor; - public IEffectiveOwner EffectiveOwner { get; private set; } - public IOccupySpace OccupiesSpace { get; private set; } - public ITargetable[] Targetables { get; private set; } + public IEffectiveOwner EffectiveOwner { get; } + public IOccupySpace OccupiesSpace { get; } + public ITargetable[] Targetables { get; } public bool IsIdle => CurrentActivity == null; public bool IsDead => Disposed || (health != null && health.IsDead); @@ -102,7 +102,7 @@ namespace OpenRA /// Read-only version of conditionCache that is passed to IConditionConsumers. readonly IReadOnlyDictionary readOnlyConditionCache; - internal SyncHash[] SyncHashes { get; private set; } + internal SyncHash[] SyncHashes { get; } readonly IFacing facing; readonly IHealth health; diff --git a/OpenRA.Game/FileFormats/Png.cs b/OpenRA.Game/FileFormats/Png.cs index 8f7d2fc991..a0ec82c65f 100644 --- a/OpenRA.Game/FileFormats/Png.cs +++ b/OpenRA.Game/FileFormats/Png.cs @@ -26,11 +26,11 @@ namespace OpenRA.FileFormats { static readonly byte[] Signature = { 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a }; - public int Width { get; private set; } - public int Height { get; private set; } - public Color[] Palette { get; private set; } - public byte[] Data { get; private set; } - public SpriteFrameType Type { get; private set; } + public int Width { get; } + public int Height { get; } + public Color[] Palette { get; } + public byte[] Data { get; } + public SpriteFrameType Type { get; } public Dictionary EmbeddedData = new Dictionary(); public int PixelStride => Type == SpriteFrameType.Indexed8 ? 1 : Type == SpriteFrameType.Rgb24 ? 3 : 4; diff --git a/OpenRA.Game/FileSystem/ZipFile.cs b/OpenRA.Game/FileSystem/ZipFile.cs index b7f1ff762c..f78b0696bb 100644 --- a/OpenRA.Game/FileSystem/ZipFile.cs +++ b/OpenRA.Game/FileSystem/ZipFile.cs @@ -142,7 +142,7 @@ namespace OpenRA.FileSystem sealed class ZipFolder : IReadOnlyPackage { public string Name => path; - public ReadOnlyZipFile Parent { get; private set; } + public ReadOnlyZipFile Parent { get; } readonly string path; public ZipFolder(ReadOnlyZipFile parent, string path) diff --git a/OpenRA.Game/GameInformation.cs b/OpenRA.Game/GameInformation.cs index cf5a6f8d3d..da4c80b362 100644 --- a/OpenRA.Game/GameInformation.cs +++ b/OpenRA.Game/GameInformation.cs @@ -35,7 +35,7 @@ namespace OpenRA /// Gets the game's duration, from the time the game started until the replay recording stopped. public TimeSpan Duration => EndTimeUtc > StartTimeUtc ? EndTimeUtc - StartTimeUtc : TimeSpan.Zero; - public IList Players { get; private set; } + public IList Players { get; } public HashSet DisabledSpawnPoints = new HashSet(); public MapPreview MapPreview => Game.ModData.MapCache[MapUid]; public IEnumerable HumanPlayers { get { return Players.Where(p => p.IsHuman); } } diff --git a/OpenRA.Game/Graphics/HardwarePalette.cs b/OpenRA.Game/Graphics/HardwarePalette.cs index 14549ce694..66c2bb8c42 100644 --- a/OpenRA.Game/Graphics/HardwarePalette.cs +++ b/OpenRA.Game/Graphics/HardwarePalette.cs @@ -17,8 +17,8 @@ namespace OpenRA.Graphics { public sealed class HardwarePalette : IDisposable { - public ITexture Texture { get; private set; } - public ITexture ColorShifts { get; private set; } + public ITexture Texture { get; } + public ITexture ColorShifts { get; } public int Height { get; private set; } readonly Dictionary palettes = new Dictionary(); diff --git a/OpenRA.Game/Graphics/SpriteFont.cs b/OpenRA.Game/Graphics/SpriteFont.cs index 9d0054d1af..8ba4d3aa7e 100644 --- a/OpenRA.Game/Graphics/SpriteFont.cs +++ b/OpenRA.Game/Graphics/SpriteFont.cs @@ -17,7 +17,7 @@ namespace OpenRA.Graphics { public sealed class SpriteFont : IDisposable { - public int TopOffset { get; private set; } + public int TopOffset { get; } readonly int size; readonly SheetBuilder builder; readonly IFont font; diff --git a/OpenRA.Game/Graphics/WorldRenderer.cs b/OpenRA.Game/Graphics/WorldRenderer.cs index fab3f3b789..eecf85c132 100644 --- a/OpenRA.Game/Graphics/WorldRenderer.cs +++ b/OpenRA.Game/Graphics/WorldRenderer.cs @@ -26,7 +26,7 @@ namespace OpenRA.Graphics public readonly Size TileSize; public readonly int TileScale; public readonly World World; - public Viewport Viewport { get; private set; } + public Viewport Viewport { get; } public readonly ITerrainLighting TerrainLighting; public event Action PaletteInvalidated = null; diff --git a/OpenRA.Game/Map/MapGrid.cs b/OpenRA.Game/Map/MapGrid.cs index 45409b6a39..a2d2a6c6b8 100644 --- a/OpenRA.Game/Map/MapGrid.cs +++ b/OpenRA.Game/Map/MapGrid.cs @@ -121,7 +121,7 @@ namespace OpenRA new WVec(256, 256, 0), // bottom right - index 5 }; - public CellRamp[] Ramps { get; private set; } + public CellRamp[] Ramps { get; } internal readonly CVec[][] TilesByDistance; diff --git a/OpenRA.Game/ModData.cs b/OpenRA.Game/ModData.cs index 7c9be18790..a5423eb44d 100644 --- a/OpenRA.Game/ModData.cs +++ b/OpenRA.Game/ModData.cs @@ -37,7 +37,7 @@ namespace OpenRA public readonly IVideoLoader[] VideoLoaders; public readonly HotkeyManager Hotkeys; public readonly Translation Translation; - public ILoadScreen LoadScreen { get; private set; } + public ILoadScreen LoadScreen { get; } public CursorProvider CursorProvider { get; private set; } public FS ModFiles; public IReadOnlyFileSystem DefaultFileSystem => ModFiles; @@ -152,7 +152,7 @@ namespace OpenRA CursorProvider = new CursorProvider(this); } - public IEnumerable Languages { get; private set; } + public IEnumerable Languages { get; } public Map PrepareMap(string uid) { diff --git a/OpenRA.Game/Network/OrderManager.cs b/OpenRA.Game/Network/OrderManager.cs index 4406844f80..a471168f77 100644 --- a/OpenRA.Game/Network/OrderManager.cs +++ b/OpenRA.Game/Network/OrderManager.cs @@ -40,7 +40,7 @@ namespace OpenRA.Network public TickTime LastTickTime; public bool GameStarted => NetFrameNumber != 0; - public IConnection Connection { get; private set; } + public IConnection Connection { get; } internal int GameSaveLastFrame = -1; internal int GameSaveLastSyncFrame = -1; diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index a81e61dd00..6caf792ea0 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -77,7 +77,7 @@ namespace OpenRA // Players in mission maps must not leave the player view public bool Spectating => !inMissionMap && (spectating || WinState != WinState.Undefined); - public World World { get; private set; } + public World World { get; } readonly bool inMissionMap; readonly bool spectating; diff --git a/OpenRA.Game/Renderer.cs b/OpenRA.Game/Renderer.cs index 29d7743d4b..33547da0ad 100644 --- a/OpenRA.Game/Renderer.cs +++ b/OpenRA.Game/Renderer.cs @@ -24,24 +24,24 @@ namespace OpenRA { enum RenderType { None, World, UI } - public SpriteRenderer WorldSpriteRenderer { get; private set; } - public RgbaSpriteRenderer WorldRgbaSpriteRenderer { get; private set; } - public RgbaColorRenderer WorldRgbaColorRenderer { get; private set; } - public ModelRenderer WorldModelRenderer { get; private set; } - public RgbaColorRenderer RgbaColorRenderer { get; private set; } - public SpriteRenderer SpriteRenderer { get; private set; } - public RgbaSpriteRenderer RgbaSpriteRenderer { get; private set; } + public SpriteRenderer WorldSpriteRenderer { get; } + public RgbaSpriteRenderer WorldRgbaSpriteRenderer { get; } + public RgbaColorRenderer WorldRgbaColorRenderer { get; } + public ModelRenderer WorldModelRenderer { get; } + public RgbaColorRenderer RgbaColorRenderer { get; } + public SpriteRenderer SpriteRenderer { get; } + public RgbaSpriteRenderer RgbaSpriteRenderer { get; } public bool WindowHasInputFocus => Window.HasInputFocus; public bool WindowIsSuspended => Window.IsSuspended; public IReadOnlyDictionary Fonts; - internal IPlatformWindow Window { get; private set; } - internal IGraphicsContext Context { get; private set; } + internal IPlatformWindow Window { get; } + internal IGraphicsContext Context { get; } - internal int SheetSize { get; private set; } - internal int TempBufferSize { get; private set; } + internal int SheetSize { get; } + internal int TempBufferSize { get; } readonly IVertexBuffer tempBuffer; readonly Stack scissorState = new Stack(); diff --git a/OpenRA.Game/Scripting/ScriptContext.cs b/OpenRA.Game/Scripting/ScriptContext.cs index 6d60350b20..511539fe30 100644 --- a/OpenRA.Game/Scripting/ScriptContext.cs +++ b/OpenRA.Game/Scripting/ScriptContext.cs @@ -129,8 +129,8 @@ namespace OpenRA.Scripting // Restrict the number of instructions that will be run per map function call const int MaxUserScriptInstructions = 1000000; - public World World { get; private set; } - public WorldRenderer WorldRenderer { get; private set; } + public World World { get; } + public WorldRenderer WorldRenderer { get; } readonly MemoryConstrainedLuaRuntime runtime; readonly LuaFunction tick; diff --git a/OpenRA.Game/Sound/Sound.cs b/OpenRA.Game/Sound/Sound.cs index 23f506061b..8eaf3772cd 100644 --- a/OpenRA.Game/Sound/Sound.cs +++ b/OpenRA.Game/Sound/Sound.cs @@ -46,7 +46,7 @@ namespace OpenRA MusicInfo currentMusic; Dictionary currentSounds = new Dictionary(); readonly Dictionary currentNotifications = new Dictionary(); - public bool DummyEngine { get; private set; } + public bool DummyEngine { get; } public Sound(IPlatform platform, SoundSettings soundSettings) { diff --git a/OpenRA.Game/Support/Benchmark.cs b/OpenRA.Game/Support/Benchmark.cs index 785112c0f9..faccabd754 100644 --- a/OpenRA.Game/Support/Benchmark.cs +++ b/OpenRA.Game/Support/Benchmark.cs @@ -31,8 +31,8 @@ namespace OpenRA.Support class BenchmarkPoint { - public int Tick { get; private set; } - public double Value { get; private set; } + public int Tick { get; } + public double Value { get; } public BenchmarkPoint(int tick, double value) { diff --git a/OpenRA.Game/World.cs b/OpenRA.Game/World.cs index 2ad159b732..68eb2f36e2 100644 --- a/OpenRA.Game/World.cs +++ b/OpenRA.Game/World.cs @@ -176,7 +176,7 @@ namespace OpenRA } } - public bool RulesContainTemporaryBlocker { get; private set; } + public bool RulesContainTemporaryBlocker { get; } bool wasLoadingGameSave; diff --git a/OpenRA.Mods.Cnc/FileSystem/BigFile.cs b/OpenRA.Mods.Cnc/FileSystem/BigFile.cs index 5b270b2ab2..6e2c476b57 100644 --- a/OpenRA.Mods.Cnc/FileSystem/BigFile.cs +++ b/OpenRA.Mods.Cnc/FileSystem/BigFile.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Cnc.FileSystem { sealed class BigFile : IReadOnlyPackage { - public string Name { get; private set; } + public string Name { get; } public IEnumerable Contents => index.Keys; readonly Dictionary index = new Dictionary(); diff --git a/OpenRA.Mods.Cnc/FileSystem/MixFile.cs b/OpenRA.Mods.Cnc/FileSystem/MixFile.cs index afc902d36b..319a183484 100644 --- a/OpenRA.Mods.Cnc/FileSystem/MixFile.cs +++ b/OpenRA.Mods.Cnc/FileSystem/MixFile.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Cnc.FileSystem { public sealed class MixFile : IReadOnlyPackage { - public string Name { get; private set; } + public string Name { get; } public IEnumerable Contents => index.Keys; readonly Dictionary index; diff --git a/OpenRA.Mods.Cnc/FileSystem/Pak.cs b/OpenRA.Mods.Cnc/FileSystem/Pak.cs index 8b68dd8794..26ceabf62e 100644 --- a/OpenRA.Mods.Cnc/FileSystem/Pak.cs +++ b/OpenRA.Mods.Cnc/FileSystem/Pak.cs @@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.FileSystem sealed class PakFile : IReadOnlyPackage { - public string Name { get; private set; } + public string Name { get; } public IEnumerable Contents => index.Keys; readonly Dictionary index = new Dictionary(); diff --git a/OpenRA.Mods.Cnc/SpriteLoaders/ShpD2Loader.cs b/OpenRA.Mods.Cnc/SpriteLoaders/ShpD2Loader.cs index f9cb323b43..0732df0fcf 100644 --- a/OpenRA.Mods.Cnc/SpriteLoaders/ShpD2Loader.cs +++ b/OpenRA.Mods.Cnc/SpriteLoaders/ShpD2Loader.cs @@ -31,7 +31,7 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders class ShpD2Frame : ISpriteFrame { public SpriteFrameType Type => SpriteFrameType.Indexed8; - public Size Size { get; private set; } + public Size Size { get; } public Size FrameSize => Size; public float2 Offset => float2.Zero; public byte[] Data { get; set; } diff --git a/OpenRA.Mods.Cnc/SpriteLoaders/ShpRemasteredLoader.cs b/OpenRA.Mods.Cnc/SpriteLoaders/ShpRemasteredLoader.cs index 898f02baec..a70c1a131b 100644 --- a/OpenRA.Mods.Cnc/SpriteLoaders/ShpRemasteredLoader.cs +++ b/OpenRA.Mods.Cnc/SpriteLoaders/ShpRemasteredLoader.cs @@ -56,7 +56,7 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders return int.Parse(match.Groups[group].Value); } - public IReadOnlyList Frames { get; private set; } + public IReadOnlyList Frames { get; } public ShpRemasteredSprite(Stream stream) { diff --git a/OpenRA.Mods.Cnc/SpriteLoaders/ShpTDLoader.cs b/OpenRA.Mods.Cnc/SpriteLoaders/ShpTDLoader.cs index 9a4789df88..4e730a58ed 100644 --- a/OpenRA.Mods.Cnc/SpriteLoaders/ShpTDLoader.cs +++ b/OpenRA.Mods.Cnc/SpriteLoaders/ShpTDLoader.cs @@ -115,7 +115,7 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders } } - public IReadOnlyList Frames { get; private set; } + public IReadOnlyList Frames { get; } public readonly Size Size; int recurseDepth = 0; diff --git a/OpenRA.Mods.Cnc/SpriteLoaders/TmpRALoader.cs b/OpenRA.Mods.Cnc/SpriteLoaders/TmpRALoader.cs index 225b694abd..0896741a66 100644 --- a/OpenRA.Mods.Cnc/SpriteLoaders/TmpRALoader.cs +++ b/OpenRA.Mods.Cnc/SpriteLoaders/TmpRALoader.cs @@ -21,8 +21,8 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders class TmpRAFrame : ISpriteFrame { public SpriteFrameType Type => SpriteFrameType.Indexed8; - public Size Size { get; private set; } - public Size FrameSize { get; private set; } + public Size Size { get; } + public Size FrameSize { get; } public float2 Offset => float2.Zero; public byte[] Data { get; set; } public bool DisableExportPadding => false; diff --git a/OpenRA.Mods.Cnc/SpriteLoaders/TmpTDLoader.cs b/OpenRA.Mods.Cnc/SpriteLoaders/TmpTDLoader.cs index 0d842ab2ae..4e2237e510 100644 --- a/OpenRA.Mods.Cnc/SpriteLoaders/TmpTDLoader.cs +++ b/OpenRA.Mods.Cnc/SpriteLoaders/TmpTDLoader.cs @@ -21,8 +21,8 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders class TmpTDFrame : ISpriteFrame { public SpriteFrameType Type => SpriteFrameType.Indexed8; - public Size Size { get; private set; } - public Size FrameSize { get; private set; } + public Size Size { get; } + public Size FrameSize { get; } public float2 Offset => float2.Zero; public byte[] Data { get; set; } public bool DisableExportPadding => false; diff --git a/OpenRA.Mods.Cnc/SpriteLoaders/TmpTSLoader.cs b/OpenRA.Mods.Cnc/SpriteLoaders/TmpTSLoader.cs index 476562bb5d..4abc66a49f 100644 --- a/OpenRA.Mods.Cnc/SpriteLoaders/TmpTSLoader.cs +++ b/OpenRA.Mods.Cnc/SpriteLoaders/TmpTSLoader.cs @@ -38,9 +38,9 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders class TmpTSFrame : ISpriteFrame { public SpriteFrameType Type => SpriteFrameType.Indexed8; - public Size Size { get; private set; } + public Size Size { get; } public Size FrameSize => Size; - public float2 Offset { get; private set; } + public float2 Offset { get; } public byte[] Data { get; set; } public byte[] DepthData { get; set; } public bool DisableExportPadding => false; diff --git a/OpenRA.Mods.Common/Commands/ChatCommands.cs b/OpenRA.Mods.Common/Commands/ChatCommands.cs index 20a1764852..3c06f8a6ed 100644 --- a/OpenRA.Mods.Common/Commands/ChatCommands.cs +++ b/OpenRA.Mods.Common/Commands/ChatCommands.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Commands public class ChatCommands : INotifyChat { - public Dictionary Commands { get; private set; } + public Dictionary Commands { get; } public ChatCommands() { diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorCopyPasteBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorCopyPasteBrush.cs index 56004a26ab..88353ca5f7 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorCopyPasteBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorCopyPasteBrush.cs @@ -176,7 +176,7 @@ namespace OpenRA.Mods.Common.Widgets class CopyPasteEditorAction : IEditorAction { - public string Text { get; private set; } + public string Text { get; } readonly MapCopyFilters copyFilters; readonly Dictionary tiles; @@ -270,10 +270,10 @@ namespace OpenRA.Mods.Common.Widgets class UndoCopyPaste { - public CPos Cell { get; private set; } - public TerrainTile MapTile { get; private set; } - public ResourceTile ResourceTile { get; private set; } - public byte Height { get; private set; } + public CPos Cell { get; } + public TerrainTile MapTile { get; } + public ResourceTile ResourceTile { get; } + public byte Height { get; } public UndoCopyPaste(CPos cell, TerrainTile mapTile, ResourceTile resourceTile, byte height) { diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs index a8ac0af4bd..1a77e1d5bf 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs @@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Widgets class RemoveActorAction : IEditorAction { - public string Text { get; private set; } + public string Text { get; } readonly EditorActorLayer editorActorLayer; readonly EditorActorPreview actor; @@ -141,7 +141,7 @@ namespace OpenRA.Mods.Common.Widgets class RemoveResourceAction : IEditorAction { - public string Text { get; private set; } + public string Text { get; } readonly IResourceLayer resourceLayer; readonly CPos cell; diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs index 013906e885..fd3608ecf1 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs @@ -153,7 +153,7 @@ namespace OpenRA.Mods.Common.Widgets class PaintTileEditorAction : IEditorAction { - public string Text { get; private set; } + public string Text { get; } readonly ushort template; readonly Map map; @@ -222,7 +222,7 @@ namespace OpenRA.Mods.Common.Widgets class FloodFillEditorAction : IEditorAction { - public string Text { get; private set; } + public string Text { get; } readonly ushort template; readonly Map map; @@ -357,9 +357,9 @@ namespace OpenRA.Mods.Common.Widgets class UndoTile { - public CPos Cell { get; private set; } - public TerrainTile MapTile { get; private set; } - public byte Height { get; private set; } + public CPos Cell { get; } + public TerrainTile MapTile { get; } + public byte Height { get; } public UndoTile(CPos cell, TerrainTile mapTile, byte height) { diff --git a/OpenRA.Mods.Common/FileFormats/IniFile.cs b/OpenRA.Mods.Common/FileFormats/IniFile.cs index b4b35dd438..9f885828c4 100644 --- a/OpenRA.Mods.Common/FileFormats/IniFile.cs +++ b/OpenRA.Mods.Common/FileFormats/IniFile.cs @@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.FileFormats public class IniSection : IEnumerable> { - public string Name { get; private set; } + public string Name { get; } readonly Dictionary values = new Dictionary(); public IniSection(string name) diff --git a/OpenRA.Mods.Common/FileSystem/InstallShieldPackage.cs b/OpenRA.Mods.Common/FileSystem/InstallShieldPackage.cs index 7726f91692..eca5a45b3f 100644 --- a/OpenRA.Mods.Common/FileSystem/InstallShieldPackage.cs +++ b/OpenRA.Mods.Common/FileSystem/InstallShieldPackage.cs @@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.FileSystem } } - public string Name { get; private set; } + public string Name { get; } public IEnumerable Contents => index.Keys; readonly Dictionary index = new Dictionary(); diff --git a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs index 79f7983522..55145e204b 100644 --- a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs +++ b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs @@ -132,20 +132,20 @@ namespace OpenRA.Mods.Common.Graphics protected readonly ISpriteSequenceLoader Loader; - public string Name { get; private set; } + public string Name { get; } public int Start { get; private set; } public int Length { get; private set; } public int Stride { get; private set; } - public int Facings { get; private set; } - public int Tick { get; private set; } - public int ZOffset { get; private set; } - public float ZRamp { get; private set; } - public int ShadowStart { get; private set; } - public int ShadowZOffset { get; private set; } + public int Facings { get; } + public int Tick { get; } + public int ZOffset { get; } + public float ZRamp { get; } + public int ShadowStart { get; } + public int ShadowZOffset { get; } public int[] Frames { get; private set; } public Rectangle Bounds { get; private set; } - public bool IgnoreWorldTint { get; private set; } - public float Scale { get; private set; } + public bool IgnoreWorldTint { get; } + public float Scale { get; } public readonly uint[] EmbeddedPalette; diff --git a/OpenRA.Mods.Common/Orders/DeployOrderTargeter.cs b/OpenRA.Mods.Common/Orders/DeployOrderTargeter.cs index 753a600314..5063e903fa 100644 --- a/OpenRA.Mods.Common/Orders/DeployOrderTargeter.cs +++ b/OpenRA.Mods.Common/Orders/DeployOrderTargeter.cs @@ -26,8 +26,8 @@ namespace OpenRA.Mods.Common.Orders this.cursor = cursor; } - public string OrderID { get; private set; } - public int OrderPriority { get; private set; } + public string OrderID { get; } + public int OrderPriority { get; } public bool TargetOverridesSelection(Actor self, in Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { return true; } public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor) diff --git a/OpenRA.Mods.Common/Orders/UnitOrderTargeter.cs b/OpenRA.Mods.Common/Orders/UnitOrderTargeter.cs index e67e7f0b25..69bdf92d12 100644 --- a/OpenRA.Mods.Common/Orders/UnitOrderTargeter.cs +++ b/OpenRA.Mods.Common/Orders/UnitOrderTargeter.cs @@ -29,8 +29,8 @@ namespace OpenRA.Mods.Common.Orders this.targetAllyUnits = targetAllyUnits; } - public string OrderID { get; private set; } - public int OrderPriority { get; private set; } + public string OrderID { get; } + public int OrderPriority { get; } public bool? ForceAttack = null; public bool TargetOverridesSelection(Actor self, in Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { return true; } diff --git a/OpenRA.Mods.Common/SpriteLoaders/DdsLoader.cs b/OpenRA.Mods.Common/SpriteLoaders/DdsLoader.cs index ba92b750fb..edacddb1e9 100644 --- a/OpenRA.Mods.Common/SpriteLoaders/DdsLoader.cs +++ b/OpenRA.Mods.Common/SpriteLoaders/DdsLoader.cs @@ -47,11 +47,11 @@ namespace OpenRA.Mods.Common.SpriteLoaders { class DdsFrame : ISpriteFrame { - public SpriteFrameType Type { get; private set; } - public Size Size { get; private set; } + public SpriteFrameType Type { get; } + public Size Size { get; } public Size FrameSize => Size; public float2 Offset => float2.Zero; - public byte[] Data { get; private set; } + public byte[] Data { get; } public bool DisableExportPadding => false; public DdsFrame(Stream stream) @@ -71,7 +71,7 @@ namespace OpenRA.Mods.Common.SpriteLoaders } } - public IReadOnlyList Frames { get; private set; } + public IReadOnlyList Frames { get; } public DdsSprite(Stream stream) { diff --git a/OpenRA.Mods.Common/SpriteLoaders/ShpTSLoader.cs b/OpenRA.Mods.Common/SpriteLoaders/ShpTSLoader.cs index 2ffceb03d4..69a5f74593 100644 --- a/OpenRA.Mods.Common/SpriteLoaders/ShpTSLoader.cs +++ b/OpenRA.Mods.Common/SpriteLoaders/ShpTSLoader.cs @@ -21,9 +21,9 @@ namespace OpenRA.Mods.Common.SpriteLoaders class ShpTSFrame : ISpriteFrame { public SpriteFrameType Type => SpriteFrameType.Indexed8; - public Size Size { get; private set; } - public Size FrameSize { get; private set; } - public float2 Offset { get; private set; } + public Size Size { get; } + public Size FrameSize { get; } + public float2 Offset { get; } public byte[] Data { get; set; } public bool DisableExportPadding => false; diff --git a/OpenRA.Mods.Common/SpriteLoaders/TgaLoader.cs b/OpenRA.Mods.Common/SpriteLoaders/TgaLoader.cs index c82c4c045b..ff710bd803 100644 --- a/OpenRA.Mods.Common/SpriteLoaders/TgaLoader.cs +++ b/OpenRA.Mods.Common/SpriteLoaders/TgaLoader.cs @@ -70,11 +70,11 @@ namespace OpenRA.Mods.Common.SpriteLoaders { public class TgaFrame : ISpriteFrame { - public SpriteFrameType Type { get; private set; } - public Size Size { get; private set; } - public Size FrameSize { get; private set; } - public float2 Offset { get; private set; } - public byte[] Data { get; private set; } + public SpriteFrameType Type { get; } + public Size Size { get; } + public Size FrameSize { get; } + public float2 Offset { get; } + public byte[] Data { get; } public bool DisableExportPadding => false; public TgaFrame() @@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.SpriteLoaders } } - public IReadOnlyList Frames { get; private set; } + public IReadOnlyList Frames { get; } public TgaSprite(Stream stream) { diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs index ec36d9759b..81b95a68f2 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs @@ -426,7 +426,7 @@ namespace OpenRA.Mods.Common.Traits } public string OrderID { get; private set; } - public int OrderPriority { get; private set; } + public int OrderPriority { get; } public bool TargetOverridesSelection(Actor self, in Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { return true; } bool CanTargetActor(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor) diff --git a/OpenRA.Mods.Common/Traits/Buildings/Building.cs b/OpenRA.Mods.Common/Traits/Buildings/Building.cs index 106e84e7c8..ee1281beb2 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Building.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Building.cs @@ -279,7 +279,7 @@ namespace OpenRA.Mods.Common.Traits readonly CPos[] transitOnlyCells; public CPos TopLeft => topLeft; - public WPos CenterPosition { get; private set; } + public WPos CenterPosition { get; } public Building(ActorInitializer init, BuildingInfo info) { diff --git a/OpenRA.Mods.Common/Traits/Health.cs b/OpenRA.Mods.Common/Traits/Health.cs index 51b4b3e093..c6dfa40378 100644 --- a/OpenRA.Mods.Common/Traits/Health.cs +++ b/OpenRA.Mods.Common/Traits/Health.cs @@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.Traits } public int HP => hp; - public int MaxHP { get; private set; } + public int MaxHP { get; } public bool IsDead => hp <= 0; public bool RemoveOnDeath = true; diff --git a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs index 566f75ef8b..b88d2baa31 100644 --- a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs +++ b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs @@ -651,7 +651,7 @@ namespace OpenRA.Mods.Common.Traits public bool Started { get; private set; } public int Slowdown { get; private set; } public bool Infinite { get; set; } - public int BuildPaletteOrder { get; private set; } + public int BuildPaletteOrder { get; } readonly ActorInfo ai; readonly BuildableInfo bi; diff --git a/OpenRA.Mods.Common/Traits/Production.cs b/OpenRA.Mods.Common/Traits/Production.cs index 66189b5b76..4d926bc557 100644 --- a/OpenRA.Mods.Common/Traits/Production.cs +++ b/OpenRA.Mods.Common/Traits/Production.cs @@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits { RallyPoint rp; - public string Faction { get; private set; } + public string Faction { get; } public Production(ActorInitializer init, ProductionInfo info) : base(info) diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs index 8396560a2a..d5d146ee4b 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs @@ -177,9 +177,9 @@ namespace OpenRA.Mods.Common.Traits class Arrow { - public Sprite Sprite { get; private set; } - public double EndAngle { get; private set; } - public WAngle Direction { get; private set; } + public Sprite Sprite { get; } + public double EndAngle { get; } + public WAngle Direction { get; } public Arrow(Sprite sprite, double endAngle, WAngle direction) { diff --git a/OpenRA.Mods.Common/Traits/World/ActorMap.cs b/OpenRA.Mods.Common/Traits/World/ActorMap.cs index 1ae690ebfa..0526f52f94 100644 --- a/OpenRA.Mods.Common/Traits/World/ActorMap.cs +++ b/OpenRA.Mods.Common/Traits/World/ActorMap.cs @@ -185,8 +185,8 @@ namespace OpenRA.Mods.Common.Traits readonly HashSet removeActorPosition = new HashSet(); readonly Predicate actorShouldBeRemoved; - public WDist LargestActorRadius { get; private set; } - public WDist LargestBlockingActorRadius { get; private set; } + public WDist LargestActorRadius { get; } + public WDist LargestBlockingActorRadius { get; } public ActorMap(World world, ActorMapInfo info) { diff --git a/OpenRA.Mods.Common/Traits/World/ControlGroups.cs b/OpenRA.Mods.Common/Traits/World/ControlGroups.cs index 263379b29c..f7a244244d 100644 --- a/OpenRA.Mods.Common/Traits/World/ControlGroups.cs +++ b/OpenRA.Mods.Common/Traits/World/ControlGroups.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits public class ControlGroups : IControlGroups, ITick, IGameSaveTraitData { readonly World world; - public string[] Groups { get; private set; } + public string[] Groups { get; } readonly List[] controlGroups; diff --git a/OpenRA.Mods.Common/Traits/World/EditorActionManager.cs b/OpenRA.Mods.Common/Traits/World/EditorActionManager.cs index f2e9c14e35..993f4f1669 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorActionManager.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorActionManager.cs @@ -161,15 +161,15 @@ namespace OpenRA.Mods.Common.Traits { } - public string Text { get; private set; } + public string Text { get; } public EditorActionStatus Status { get; set; } } public class EditorActionContainer { - public int Id { get; private set; } - public IEditorAction Action { get; private set; } + public int Id { get; } + public IEditorAction Action { get; } public EditorActionStatus Status { get; set; } public EditorActionContainer(int id, IEditorAction action) diff --git a/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs b/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs index 51d934f29a..a31ad3435d 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs @@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits public string ID { get; set; } public PlayerReference Owner { get; set; } - public SubCell SubCell { get; private set; } + public SubCell SubCell { get; } public bool Selected { get; set; } public Color RadarColor { get; private set; } readonly RadarColorFromTerrainInfo terrainRadarColorInfo; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs index 22c837bc8f..47d862e05c 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorEditLogic.cs @@ -446,7 +446,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic class EditActorEditorAction : IEditorAction { - public string Text { get; private set; } + public string Text { get; } readonly IEnumerable handles; readonly EditorActorLayer editorActorLayer; diff --git a/OpenRA.Mods.Common/Widgets/RadarWidget.cs b/OpenRA.Mods.Common/Widgets/RadarWidget.cs index 6c978876fa..6745f8dc73 100644 --- a/OpenRA.Mods.Common/Widgets/RadarWidget.cs +++ b/OpenRA.Mods.Common/Widgets/RadarWidget.cs @@ -60,8 +60,8 @@ namespace OpenRA.Mods.Common.Widgets PlayerRadarTerrain playerRadarTerrain; Player currentPlayer; - public string SoundUp { get; private set; } - public string SoundDown { get; private set; } + public string SoundUp { get; } + public string SoundDown { get; } [ObjectCreator.UseCtor] public RadarWidget(World world, WorldRenderer worldRenderer) diff --git a/OpenRA.Mods.D2k/PackageLoaders/D2kSoundResources.cs b/OpenRA.Mods.D2k/PackageLoaders/D2kSoundResources.cs index adb8bf50c8..f0da75a7d8 100644 --- a/OpenRA.Mods.D2k/PackageLoaders/D2kSoundResources.cs +++ b/OpenRA.Mods.D2k/PackageLoaders/D2kSoundResources.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.D2k.PackageLoaders } } - public string Name { get; private set; } + public string Name { get; } public IEnumerable Contents => index.Keys; readonly Stream s; diff --git a/OpenRA.Mods.D2k/SpriteLoaders/R8Loader.cs b/OpenRA.Mods.D2k/SpriteLoaders/R8Loader.cs index 185fd95e58..ce70145397 100644 --- a/OpenRA.Mods.D2k/SpriteLoaders/R8Loader.cs +++ b/OpenRA.Mods.D2k/SpriteLoaders/R8Loader.cs @@ -22,9 +22,9 @@ namespace OpenRA.Mods.D2k.SpriteLoaders class R8Frame : ISpriteFrame { public SpriteFrameType Type => SpriteFrameType.Indexed8; - public Size Size { get; private set; } - public Size FrameSize { get; private set; } - public float2 Offset { get; private set; } + public Size Size { get; } + public Size FrameSize { get; } + public float2 Offset { get; } public byte[] Data { get; set; } public bool DisableExportPadding => true; diff --git a/OpenRA.Platforms.Default/OpenAlSoundEngine.cs b/OpenRA.Platforms.Default/OpenAlSoundEngine.cs index 2658f74e20..5415f1a201 100644 --- a/OpenRA.Platforms.Default/OpenAlSoundEngine.cs +++ b/OpenRA.Platforms.Default/OpenAlSoundEngine.cs @@ -387,7 +387,7 @@ namespace OpenRA.Platforms.Default bool disposed; public uint Buffer => buffer; - public int SampleRate { get; private set; } + public int SampleRate { get; } public OpenAlSoundSource(byte[] data, int byteCount, int channels, int sampleBits, int sampleRate) {