diff --git a/OpenRA.Game/Activities/Activity.cs b/OpenRA.Game/Activities/Activity.cs
index 8f2493005e..0fa330a896 100644
--- a/OpenRA.Game/Activities/Activity.cs
+++ b/OpenRA.Game/Activities/Activity.cs
@@ -53,15 +53,15 @@ namespace OpenRA.Activities
Activity childActivity;
protected Activity ChildActivity
{
- get { return SkipDoneActivities(childActivity); }
- private set { childActivity = value; }
+ get => SkipDoneActivities(childActivity);
+ private set => childActivity = value;
}
Activity nextActivity;
public Activity NextActivity
{
- get { return SkipDoneActivities(nextActivity); }
- private set { nextActivity = value; }
+ get => SkipDoneActivities(nextActivity);
+ private set => nextActivity = value;
}
internal static Activity SkipDoneActivities(Activity first)
@@ -81,7 +81,7 @@ namespace OpenRA.Activities
public bool IsInterruptible { get; protected set; }
public bool ChildHasPriority { get; protected set; }
- public bool IsCanceling { get { return State == ActivityState.Canceling; } }
+ public bool IsCanceling => State == ActivityState.Canceling;
bool finishing;
bool firstRunCompleted;
bool lastRun;
diff --git a/OpenRA.Game/Actor.cs b/OpenRA.Game/Actor.cs
index c5b50101d0..421fc28c25 100644
--- a/OpenRA.Game/Actor.cs
+++ b/OpenRA.Game/Actor.cs
@@ -48,8 +48,8 @@ namespace OpenRA
Activity currentActivity;
public Activity CurrentActivity
{
- get { return Activity.SkipDoneActivities(currentActivity); }
- private set { currentActivity = value; }
+ get => Activity.SkipDoneActivities(currentActivity);
+ private set => currentActivity = value;
}
public int Generation;
@@ -59,19 +59,13 @@ namespace OpenRA
public IOccupySpace OccupiesSpace { get; private set; }
public ITargetable[] Targetables { get; private set; }
- public bool IsIdle { get { return CurrentActivity == null; } }
- public bool IsDead { get { return Disposed || (health != null && health.IsDead); } }
+ public bool IsIdle => CurrentActivity == null;
+ public bool IsDead => Disposed || (health != null && health.IsDead);
- public CPos Location { get { return OccupiesSpace.TopLeft; } }
- public WPos CenterPosition { get { return OccupiesSpace.CenterPosition; } }
+ public CPos Location => OccupiesSpace.TopLeft;
+ public WPos CenterPosition => OccupiesSpace.CenterPosition;
- public WRot Orientation
- {
- get
- {
- return facing != null ? facing.Orientation : WRot.None;
- }
- }
+ public WRot Orientation => facing != null ? facing.Orientation : WRot.None;
/// Value used to represent an invalid token.
public static readonly int InvalidConditionToken = -1;
@@ -615,8 +609,8 @@ namespace OpenRA
public LuaValue this[LuaRuntime runtime, LuaValue keyValue]
{
- get { return luaInterface.Value[runtime, keyValue]; }
- set { luaInterface.Value[runtime, keyValue] = value; }
+ get => luaInterface.Value[runtime, keyValue];
+ set => luaInterface.Value[runtime, keyValue] = value;
}
public LuaValue Equals(LuaRuntime runtime, LuaValue left, LuaValue right)
diff --git a/OpenRA.Game/CPos.cs b/OpenRA.Game/CPos.cs
index 06a578d167..35caf2d52a 100644
--- a/OpenRA.Game/CPos.cs
+++ b/OpenRA.Game/CPos.cs
@@ -25,13 +25,13 @@ namespace OpenRA
public readonly int Bits;
// X is padded to MSB, so bit shift does the correct sign extension
- public int X { get { return Bits >> 20; } }
+ public int X => Bits >> 20;
// Align Y with a short, cast, then shift the rest of the way
// The signed short bit shift does the correct sign extension
- public int Y { get { return ((short)(Bits >> 4)) >> 4; } }
+ public int Y => ((short)(Bits >> 4)) >> 4;
- public byte Layer { get { return (byte)Bits; } }
+ public byte Layer => (byte)Bits;
public CPos(int bits) { Bits = bits; }
public CPos(int x, int y)
@@ -136,10 +136,7 @@ namespace OpenRA
}
}
- set
- {
- throw new LuaException("CPos is read-only. Use CPos.New to create a new value");
- }
+ set => throw new LuaException("CPos is read-only. Use CPos.New to create a new value");
}
#endregion
diff --git a/OpenRA.Game/CVec.cs b/OpenRA.Game/CVec.cs
index 2892537962..4a7910d976 100644
--- a/OpenRA.Game/CVec.cs
+++ b/OpenRA.Game/CVec.cs
@@ -42,8 +42,8 @@ namespace OpenRA
public CVec Sign() { return new CVec(Math.Sign(X), Math.Sign(Y)); }
public CVec Abs() { return new CVec(Math.Abs(X), Math.Abs(Y)); }
- public int LengthSquared { get { return X * X + Y * Y; } }
- public int Length { get { return Exts.ISqrt(LengthSquared); } }
+ public int LengthSquared => X * X + Y * Y;
+ public int Length => Exts.ISqrt(LengthSquared);
public CVec Clamp(Rectangle r)
{
@@ -114,10 +114,7 @@ namespace OpenRA
}
}
- set
- {
- throw new LuaException("CVec is read-only. Use CVec.New to create a new value");
- }
+ set => throw new LuaException("CVec is read-only. Use CVec.New to create a new value");
}
#endregion
diff --git a/OpenRA.Game/ExternalMods.cs b/OpenRA.Game/ExternalMods.cs
index 96ad758d75..aca8037892 100644
--- a/OpenRA.Game/ExternalMods.cs
+++ b/OpenRA.Game/ExternalMods.cs
@@ -290,10 +290,10 @@ namespace OpenRA
}
}
- public ExternalMod this[string key] { get { return mods[key]; } }
- public int Count { get { return mods.Count; } }
- public ICollection Keys { get { return mods.Keys; } }
- public ICollection Values { get { return mods.Values; } }
+ public ExternalMod this[string key] => mods[key];
+ public int Count => mods.Count;
+ public ICollection Keys => mods.Keys;
+ public ICollection Values => mods.Values;
public bool ContainsKey(string key) { return mods.ContainsKey(key); }
public IEnumerator> GetEnumerator() { return mods.GetEnumerator(); }
public bool TryGetValue(string key, out ExternalMod value) { return mods.TryGetValue(key, out value); }
diff --git a/OpenRA.Game/FieldLoader.cs b/OpenRA.Game/FieldLoader.cs
index 03dd94f647..dd27d8ce91 100644
--- a/OpenRA.Game/FieldLoader.cs
+++ b/OpenRA.Game/FieldLoader.cs
@@ -651,7 +651,7 @@ namespace OpenRA
{
public static readonly SerializeAttribute Default = new SerializeAttribute(true);
- public bool IsDefault { get { return this == Default; } }
+ public bool IsDefault => this == Default;
public readonly bool Serialize;
public string YamlName;
diff --git a/OpenRA.Game/FileFormats/Png.cs b/OpenRA.Game/FileFormats/Png.cs
index cd64e708a9..2bb4f2c552 100644
--- a/OpenRA.Game/FileFormats/Png.cs
+++ b/OpenRA.Game/FileFormats/Png.cs
@@ -33,7 +33,7 @@ namespace OpenRA.FileFormats
public SpriteFrameType Type { get; private set; }
public Dictionary EmbeddedData = new Dictionary();
- public int PixelStride { get { return Type == SpriteFrameType.Indexed8 ? 1 : Type == SpriteFrameType.Rgb24 ? 3 : 4; } }
+ public int PixelStride => Type == SpriteFrameType.Indexed8 ? 1 : Type == SpriteFrameType.Rgb24 ? 3 : 4;
public Png(Stream s)
{
diff --git a/OpenRA.Game/FileSystem/FileSystem.cs b/OpenRA.Game/FileSystem/FileSystem.cs
index 1648909a33..16ebe4c613 100644
--- a/OpenRA.Game/FileSystem/FileSystem.cs
+++ b/OpenRA.Game/FileSystem/FileSystem.cs
@@ -28,7 +28,7 @@ namespace OpenRA.FileSystem
public class FileSystem : IReadOnlyFileSystem
{
- public IEnumerable MountedPackages { get { return mountedPackages.Keys; } }
+ public IEnumerable MountedPackages => mountedPackages.Keys;
readonly Dictionary mountedPackages = new Dictionary();
readonly Dictionary explicitMounts = new Dictionary();
readonly string modID;
diff --git a/OpenRA.Game/FileSystem/Folder.cs b/OpenRA.Game/FileSystem/Folder.cs
index d9b9d7328e..1a3856a1c9 100644
--- a/OpenRA.Game/FileSystem/Folder.cs
+++ b/OpenRA.Game/FileSystem/Folder.cs
@@ -27,7 +27,7 @@ namespace OpenRA.FileSystem
Directory.CreateDirectory(path);
}
- public string Name { get { return path; } }
+ public string Name => path;
public IEnumerable Contents
{
diff --git a/OpenRA.Game/FileSystem/ZipFile.cs b/OpenRA.Game/FileSystem/ZipFile.cs
index 5fc0a16afa..cdacbd85d0 100644
--- a/OpenRA.Game/FileSystem/ZipFile.cs
+++ b/OpenRA.Game/FileSystem/ZipFile.cs
@@ -141,7 +141,7 @@ namespace OpenRA.FileSystem
sealed class ZipFolder : IReadOnlyPackage
{
- public string Name { get { return path; } }
+ public string Name => path;
public ReadOnlyZipFile Parent { get; private set; }
readonly string path;
diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs
index 034cb32fa8..670b8e3180 100644
--- a/OpenRA.Game/Game.cs
+++ b/OpenRA.Game/Game.cs
@@ -99,16 +99,16 @@ namespace OpenRA
// More accurate replacement for Environment.TickCount
static Stopwatch stopwatch = Stopwatch.StartNew();
- public static long RunTime { get { return stopwatch.ElapsedMilliseconds; } }
+ public static long RunTime => stopwatch.ElapsedMilliseconds;
public static int RenderFrame = 0;
- public static int NetFrameNumber { get { return OrderManager.NetFrameNumber; } }
- public static int LocalTick { get { return OrderManager.LocalFrameNumber; } }
+ public static int NetFrameNumber => OrderManager.NetFrameNumber;
+ public static int LocalTick => OrderManager.LocalFrameNumber;
public static event Action OnRemoteDirectConnect = _ => { };
public static event Action ConnectionStateChanged = _ => { };
static ConnectionState lastConnectionState = ConnectionState.PreConnecting;
- public static int LocalClientId { get { return OrderManager.Connection.LocalClientId; } }
+ public static int LocalClientId => OrderManager.Connection.LocalClientId;
public static void RemoteDirectConnect(ConnectionTarget endpoint)
{
diff --git a/OpenRA.Game/GameInformation.cs b/OpenRA.Game/GameInformation.cs
index 96acd686e1..e78d1bdf6c 100644
--- a/OpenRA.Game/GameInformation.cs
+++ b/OpenRA.Game/GameInformation.cs
@@ -33,12 +33,13 @@ namespace OpenRA
public DateTime EndTimeUtc;
/// Gets the game's duration, from the time the game started until the replay recording stopped.
- public TimeSpan Duration { get { return EndTimeUtc > StartTimeUtc ? EndTimeUtc - StartTimeUtc : TimeSpan.Zero; } }
+ public TimeSpan Duration => EndTimeUtc > StartTimeUtc ? EndTimeUtc - StartTimeUtc : TimeSpan.Zero;
+
public IList Players { get; private set; }
public HashSet DisabledSpawnPoints = new HashSet();
- public MapPreview MapPreview { get { return Game.ModData.MapCache[MapUid]; } }
+ public MapPreview MapPreview => Game.ModData.MapCache[MapUid];
public IEnumerable HumanPlayers { get { return Players.Where(p => p.IsHuman); } }
- public bool IsSinglePlayer { get { return HumanPlayers.Count() == 1; } }
+ public bool IsSinglePlayer => HumanPlayers.Count() == 1;
readonly Dictionary playersByRuntime;
diff --git a/OpenRA.Game/Graphics/Animation.cs b/OpenRA.Game/Graphics/Animation.cs
index bf4f682286..8e825e7b11 100644
--- a/OpenRA.Game/Graphics/Animation.cs
+++ b/OpenRA.Game/Graphics/Animation.cs
@@ -49,8 +49,8 @@ namespace OpenRA.Graphics
this.paused = paused;
}
- public int CurrentFrame { get { return backwards ? CurrentSequence.Length - frame - 1 : frame; } }
- public Sprite Image { get { return CurrentSequence.GetSprite(CurrentFrame, facingFunc()); } }
+ public int CurrentFrame => backwards ? CurrentSequence.Length - frame - 1 : frame;
+ public Sprite Image => CurrentSequence.GetSprite(CurrentFrame, facingFunc());
public IRenderable[] Render(WPos pos, WVec offset, int zOffset, PaletteReference palette)
{
diff --git a/OpenRA.Game/Graphics/Model.cs b/OpenRA.Game/Graphics/Model.cs
index b912534992..1eb3526ca7 100644
--- a/OpenRA.Game/Graphics/Model.cs
+++ b/OpenRA.Game/Graphics/Model.cs
@@ -63,7 +63,7 @@ namespace OpenRA.Graphics
class PlaceholderModelCache : IModelCache
{
- public IVertexBuffer VertexBuffer { get { throw new NotImplementedException(); } }
+ public IVertexBuffer VertexBuffer => throw new NotImplementedException();
public void Dispose() { }
diff --git a/OpenRA.Game/Graphics/ModelAnimation.cs b/OpenRA.Game/Graphics/ModelAnimation.cs
index 884363a45b..6bc96f060b 100644
--- a/OpenRA.Game/Graphics/ModelAnimation.cs
+++ b/OpenRA.Game/Graphics/ModelAnimation.cs
@@ -46,12 +46,6 @@ namespace OpenRA.Graphics
xy.Y + (int)(r.Bottom * scale));
}
- public bool IsVisible
- {
- get
- {
- return DisableFunc == null || !DisableFunc();
- }
- }
+ public bool IsVisible => DisableFunc == null || !DisableFunc();
}
}
diff --git a/OpenRA.Game/Graphics/Palette.cs b/OpenRA.Game/Graphics/Palette.cs
index c7994960db..2972662950 100644
--- a/OpenRA.Game/Graphics/Palette.cs
+++ b/OpenRA.Game/Graphics/Palette.cs
@@ -44,7 +44,8 @@ namespace OpenRA.Graphics
{
IPalette palette;
public ReadOnlyPalette(IPalette palette) { this.palette = palette; }
- public uint this[int index] { get { return palette[index]; } }
+ public uint this[int index] => palette[index];
+
public void CopyToArray(Array destination, int destinationOffset)
{
palette.CopyToArray(destination, destinationOffset);
@@ -56,10 +57,7 @@ namespace OpenRA.Graphics
{
readonly uint[] colors = new uint[Palette.Size];
- public uint this[int index]
- {
- get { return colors[index]; }
- }
+ public uint this[int index] => colors[index];
public void CopyToArray(Array destination, int destinationOffset)
{
@@ -126,8 +124,8 @@ namespace OpenRA.Graphics
public uint this[int index]
{
- get { return colors[index]; }
- set { colors[index] = value; }
+ get => colors[index];
+ set => colors[index] = value;
}
public void CopyToArray(Array destination, int destinationOffset)
diff --git a/OpenRA.Game/Graphics/PaletteReference.cs b/OpenRA.Game/Graphics/PaletteReference.cs
index 51becfe3e4..26b948ac69 100644
--- a/OpenRA.Game/Graphics/PaletteReference.cs
+++ b/OpenRA.Game/Graphics/PaletteReference.cs
@@ -18,8 +18,8 @@ namespace OpenRA.Graphics
public readonly string Name;
public IPalette Palette { get; internal set; }
- public float TextureIndex { get { return index / hardwarePalette.Height; } }
- public float TextureMidIndex { get { return (index + 0.5f) / hardwarePalette.Height; } }
+ public float TextureIndex => index / hardwarePalette.Height;
+ public float TextureMidIndex => (index + 0.5f) / hardwarePalette.Height;
public PaletteReference(string name, int index, IPalette palette, HardwarePalette hardwarePalette)
{
diff --git a/OpenRA.Game/Graphics/SequenceProvider.cs b/OpenRA.Game/Graphics/SequenceProvider.cs
index 659da8880f..2324c72d5a 100644
--- a/OpenRA.Game/Graphics/SequenceProvider.cs
+++ b/OpenRA.Game/Graphics/SequenceProvider.cs
@@ -52,7 +52,7 @@ namespace OpenRA.Graphics
readonly string tileSet;
readonly Lazy sequences;
readonly Lazy spriteCache;
- public SpriteCache SpriteCache { get { return spriteCache.Value; } }
+ public SpriteCache SpriteCache => spriteCache.Value;
readonly Dictionary sequenceCache = new Dictionary();
@@ -80,7 +80,7 @@ namespace OpenRA.Graphics
return seq;
}
- public IEnumerable Images { get { return sequences.Value.Keys; } }
+ public IEnumerable Images => sequences.Value.Keys;
public bool HasSequence(string unitName)
{
diff --git a/OpenRA.Game/Graphics/Sheet.cs b/OpenRA.Game/Graphics/Sheet.cs
index bb9bae1b35..a8d76f668b 100644
--- a/OpenRA.Game/Graphics/Sheet.cs
+++ b/OpenRA.Game/Graphics/Sheet.cs
@@ -32,7 +32,7 @@ namespace OpenRA.Graphics
return data;
}
- public bool Buffered { get { return data != null || texture == null; } }
+ public bool Buffered => data != null || texture == null;
public Sheet(SheetType type, Size size)
{
diff --git a/OpenRA.Game/Graphics/SheetBuilder.cs b/OpenRA.Game/Graphics/SheetBuilder.cs
index 0e66d465f9..76e59fb98f 100644
--- a/OpenRA.Game/Graphics/SheetBuilder.cs
+++ b/OpenRA.Game/Graphics/SheetBuilder.cs
@@ -147,9 +147,9 @@ namespace OpenRA.Graphics
return rect;
}
- public Sheet Current { get { return current; } }
- public TextureChannel CurrentChannel { get { return channel; } }
- public IEnumerable AllSheets { get { return sheets; } }
+ public Sheet Current => current;
+ public TextureChannel CurrentChannel => channel;
+ public IEnumerable AllSheets => sheets;
public void Dispose()
{
diff --git a/OpenRA.Game/Graphics/SpriteLoader.cs b/OpenRA.Game/Graphics/SpriteLoader.cs
index eba92e89c3..d6fcb903bb 100644
--- a/OpenRA.Game/Graphics/SpriteLoader.cs
+++ b/OpenRA.Game/Graphics/SpriteLoader.cs
@@ -164,7 +164,7 @@ namespace OpenRA.Graphics
frames = new Cache(filename => FrameLoader.GetFrames(fileSystem, filename, loaders, out _));
}
- public ISpriteFrame[] this[string filename] { get { return frames[filename]; } }
+ public ISpriteFrame[] this[string filename] => frames[filename];
}
public static class FrameLoader
diff --git a/OpenRA.Game/Graphics/SpriteRenderable.cs b/OpenRA.Game/Graphics/SpriteRenderable.cs
index ef8bdba409..e478e17d44 100644
--- a/OpenRA.Game/Graphics/SpriteRenderable.cs
+++ b/OpenRA.Game/Graphics/SpriteRenderable.cs
@@ -43,15 +43,15 @@ namespace OpenRA.Graphics
this.alpha = alpha;
}
- public WPos Pos { get { return pos + offset; } }
- public WVec Offset { get { return offset; } }
- public PaletteReference Palette { get { return palette; } }
- public int ZOffset { get { return zOffset; } }
- public bool IsDecoration { get { return isDecoration; } }
+ public WPos Pos => pos + offset;
+ public WVec Offset => offset;
+ public PaletteReference Palette => palette;
+ public int ZOffset => zOffset;
+ public bool IsDecoration => isDecoration;
- public float Alpha { get { return alpha; } }
- public float3 Tint { get { return tint; } }
- public TintModifiers TintModifiers { get { return tintModifiers; } }
+ public float Alpha => alpha;
+ public float3 Tint => tint;
+ public TintModifiers TintModifiers => tintModifiers;
public IPalettedRenderable WithPalette(PaletteReference newPalette) { return new SpriteRenderable(sprite, pos, offset, zOffset, newPalette, scale, alpha, tint, tintModifiers, isDecoration); }
public IRenderable WithZOffset(int newOffset) { return new SpriteRenderable(sprite, pos, offset, newOffset, palette, scale, alpha, tint, tintModifiers, isDecoration); }
diff --git a/OpenRA.Game/Graphics/TargetLineRenderable.cs b/OpenRA.Game/Graphics/TargetLineRenderable.cs
index 8473c7048f..ecc542abcd 100644
--- a/OpenRA.Game/Graphics/TargetLineRenderable.cs
+++ b/OpenRA.Game/Graphics/TargetLineRenderable.cs
@@ -30,9 +30,9 @@ namespace OpenRA.Graphics
this.markerSize = markerSize;
}
- public WPos Pos { get { return waypoints.First(); } }
- public int ZOffset { get { return 0; } }
- public bool IsDecoration { get { return true; } }
+ public WPos Pos => waypoints.First();
+ public int ZOffset => 0;
+ public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return new TargetLineRenderable(waypoints, color); }
public IRenderable OffsetBy(WVec vec) { return new TargetLineRenderable(waypoints.Select(w => w + vec), color); }
diff --git a/OpenRA.Game/Graphics/UISpriteRenderable.cs b/OpenRA.Game/Graphics/UISpriteRenderable.cs
index 0afac9c62e..0930881138 100644
--- a/OpenRA.Game/Graphics/UISpriteRenderable.cs
+++ b/OpenRA.Game/Graphics/UISpriteRenderable.cs
@@ -35,12 +35,12 @@ namespace OpenRA.Graphics
}
// Does not exist in the world, so a world positions don't make sense
- public WPos Pos { get { return effectiveWorldPos; } }
- public WVec Offset { get { return WVec.Zero; } }
- public bool IsDecoration { get { return true; } }
+ public WPos Pos => effectiveWorldPos;
+ public WVec Offset => WVec.Zero;
+ public bool IsDecoration => true;
- public PaletteReference Palette { get { return palette; } }
- public int ZOffset { get { return zOffset; } }
+ public PaletteReference Palette => palette;
+ public int ZOffset => zOffset;
public IPalettedRenderable WithPalette(PaletteReference newPalette) { return new UISpriteRenderable(sprite, effectiveWorldPos, screenPos, zOffset, newPalette, scale, alpha); }
public IRenderable WithZOffset(int newOffset) { return this; }
diff --git a/OpenRA.Game/Graphics/Viewport.cs b/OpenRA.Game/Graphics/Viewport.cs
index 05aacec8ce..dc137c5c6c 100644
--- a/OpenRA.Game/Graphics/Viewport.cs
+++ b/OpenRA.Game/Graphics/Viewport.cs
@@ -51,11 +51,11 @@ namespace OpenRA.Graphics
// Viewport geometry (world-px)
public int2 CenterLocation { get; private set; }
- public WPos CenterPosition { get { return worldRenderer.ProjectedPosition(CenterLocation); } }
+ public WPos CenterPosition => worldRenderer.ProjectedPosition(CenterLocation);
- public Rectangle Rectangle { get { return new Rectangle(TopLeft, new Size(viewportSize.X, viewportSize.Y)); } }
- public int2 TopLeft { get { return CenterLocation - viewportSize / 2; } }
- public int2 BottomRight { get { return CenterLocation + viewportSize / 2; } }
+ public Rectangle Rectangle => new Rectangle(TopLeft, new Size(viewportSize.X, viewportSize.Y));
+ public int2 TopLeft => CenterLocation - viewportSize / 2;
+ public int2 BottomRight => CenterLocation + viewportSize / 2;
int2 viewportSize;
ProjectedCellRegion cells;
bool cellsDirty = true;
@@ -75,10 +75,7 @@ namespace OpenRA.Graphics
public float Zoom
{
- get
- {
- return zoom;
- }
+ get => zoom;
private set
{
@@ -89,7 +86,7 @@ namespace OpenRA.Graphics
}
}
- public float MinZoom { get { return minZoom; } }
+ public float MinZoom => minZoom;
public void AdjustZoom(float dz)
{
diff --git a/OpenRA.Game/HotkeyManager.cs b/OpenRA.Game/HotkeyManager.cs
index 392d16971f..0a028b7dae 100644
--- a/OpenRA.Game/HotkeyManager.cs
+++ b/OpenRA.Game/HotkeyManager.cs
@@ -96,14 +96,8 @@ namespace OpenRA
return null;
}
- public HotkeyReference this[string name]
- {
- get
- {
- return new HotkeyReference(GetHotkeyReference(name));
- }
- }
+ public HotkeyReference this[string name] => new HotkeyReference(GetHotkeyReference(name));
- public IEnumerable Definitions { get { return definitions.Values; } }
+ public IEnumerable Definitions => definitions.Values;
}
}
diff --git a/OpenRA.Game/Input/InputHandler.cs b/OpenRA.Game/Input/InputHandler.cs
index b36432fb12..d4094d3b8c 100644
--- a/OpenRA.Game/Input/InputHandler.cs
+++ b/OpenRA.Game/Input/InputHandler.cs
@@ -53,20 +53,8 @@ namespace OpenRA
public class MouseButtonPreference
{
- public MouseButton Action
- {
- get
- {
- return Game.Settings.Game.UseClassicMouseStyle ? MouseButton.Left : MouseButton.Right;
- }
- }
+ public MouseButton Action => Game.Settings.Game.UseClassicMouseStyle ? MouseButton.Left : MouseButton.Right;
- public MouseButton Cancel
- {
- get
- {
- return Game.Settings.Game.UseClassicMouseStyle ? MouseButton.Right : MouseButton.Left;
- }
- }
+ public MouseButton Cancel => Game.Settings.Game.UseClassicMouseStyle ? MouseButton.Right : MouseButton.Left;
}
}
diff --git a/OpenRA.Game/InstalledMods.cs b/OpenRA.Game/InstalledMods.cs
index 27c8728826..14ae4157ef 100644
--- a/OpenRA.Game/InstalledMods.cs
+++ b/OpenRA.Game/InstalledMods.cs
@@ -99,10 +99,10 @@ namespace OpenRA
return ret;
}
- public Manifest this[string key] { get { return mods[key]; } }
- public int Count { get { return mods.Count; } }
- public ICollection Keys { get { return mods.Keys; } }
- public ICollection Values { get { return mods.Values; } }
+ public Manifest this[string key] => mods[key];
+ public int Count => mods.Count;
+ public ICollection Keys => mods.Keys;
+ public ICollection Values => mods.Values;
public bool ContainsKey(string key) { return mods.ContainsKey(key); }
public IEnumerator> GetEnumerator() { return mods.GetEnumerator(); }
public bool TryGetValue(string key, out Manifest value) { return mods.TryGetValue(key, out value); }
diff --git a/OpenRA.Game/LocalPlayerProfile.cs b/OpenRA.Game/LocalPlayerProfile.cs
index 9da2b880e3..833a17a285 100644
--- a/OpenRA.Game/LocalPlayerProfile.cs
+++ b/OpenRA.Game/LocalPlayerProfile.cs
@@ -24,11 +24,11 @@ namespace OpenRA
const int AuthKeySize = 2048;
public enum LinkState { Uninitialized, GeneratingKeys, Unlinked, CheckingLink, ConnectionFailed, Linked }
- public LinkState State { get { return innerState; } }
- public string Fingerprint { get { return innerFingerprint; } }
- public string PublicKey { get { return innerPublicKey; } }
+ public LinkState State => innerState;
+ public string Fingerprint => innerFingerprint;
+ public string PublicKey => innerPublicKey;
- public PlayerProfile ProfileData { get { return innerData; } }
+ public PlayerProfile ProfileData => innerData;
volatile LinkState innerState;
volatile PlayerProfile innerData;
diff --git a/OpenRA.Game/Map/ActorInitializer.cs b/OpenRA.Game/Map/ActorInitializer.cs
index ffe7f523a5..4f0cf50691 100644
--- a/OpenRA.Game/Map/ActorInitializer.cs
+++ b/OpenRA.Game/Map/ActorInitializer.cs
@@ -37,7 +37,7 @@ namespace OpenRA
public class ActorInitializer : IActorInitializer
{
public readonly Actor Self;
- public World World { get { return Self.World; } }
+ public World World => Self.World;
internal TypeDictionary Dict;
@@ -150,7 +150,7 @@ namespace OpenRA
protected ValueActorInit(T value) { this.value = value; }
- public virtual T Value { get { return value; } }
+ public virtual T Value => value;
public virtual void Initialize(MiniYaml yaml)
{
diff --git a/OpenRA.Game/Map/ActorReference.cs b/OpenRA.Game/Map/ActorReference.cs
index 1977dacac2..80e6afb1da 100644
--- a/OpenRA.Game/Map/ActorReference.cs
+++ b/OpenRA.Game/Map/ActorReference.cs
@@ -27,7 +27,7 @@ namespace OpenRA
public string Type;
Lazy initDict;
- internal TypeDictionary InitDict { get { return initDict.Value; } }
+ internal TypeDictionary InitDict => initDict.Value;
public ActorReference(string type)
: this(type, new Dictionary()) { }
diff --git a/OpenRA.Game/Map/CellLayer.cs b/OpenRA.Game/Map/CellLayer.cs
index 3a291ec45c..ed5dae94e9 100644
--- a/OpenRA.Game/Map/CellLayer.cs
+++ b/OpenRA.Game/Map/CellLayer.cs
@@ -64,10 +64,7 @@ namespace OpenRA
/// Gets or sets the using cell coordinates
public T this[CPos cell]
{
- get
- {
- return entries[Index(cell)];
- }
+ get => entries[Index(cell)];
set
{
@@ -80,10 +77,7 @@ namespace OpenRA
/// Gets or sets the layer contents using raw map coordinates (not CPos!)
public T this[MPos uv]
{
- get
- {
- return entries[Index(uv)];
- }
+ get => entries[Index(uv)];
set
{
diff --git a/OpenRA.Game/Map/CellRegion.cs b/OpenRA.Game/Map/CellRegion.cs
index a3a23e6f51..7f0da7d671 100644
--- a/OpenRA.Game/Map/CellRegion.cs
+++ b/OpenRA.Game/Map/CellRegion.cs
@@ -97,10 +97,7 @@ namespace OpenRA
return uv.U >= mapTopLeft.U && uv.U <= mapBottomRight.U && uv.V >= mapTopLeft.V && uv.V <= mapBottomRight.V;
}
- public MapCoordsRegion MapCoords
- {
- get { return new MapCoordsRegion(mapTopLeft, mapBottomRight); }
- }
+ public MapCoordsRegion MapCoords => new MapCoordsRegion(mapTopLeft, mapBottomRight);
public CellRegionEnumerator GetEnumerator()
{
@@ -161,8 +158,8 @@ namespace OpenRA
v = r.mapTopLeft.V;
}
- public CPos Current { get { return current; } }
- object IEnumerator.Current { get { return Current; } }
+ public CPos Current => current;
+ object IEnumerator.Current => Current;
public void Dispose() { }
}
}
diff --git a/OpenRA.Game/Map/Map.cs b/OpenRA.Game/Map/Map.cs
index bbc7fe954f..c122c6cfa9 100644
--- a/OpenRA.Game/Map/Map.cs
+++ b/OpenRA.Game/Map/Map.cs
@@ -902,15 +902,9 @@ namespace OpenRA
///
/// The size of the map Height step in world units
///
- public WDist CellHeightStep
- {
- get
- {
- // RectangularIsometric defines 1024 units along the diagonal axis,
- // giving a half-tile height step of sqrt(2) * 512
- return new WDist(Grid.Type == MapGridType.RectangularIsometric ? 724 : 512);
- }
- }
+ /// RectangularIsometric defines 1024 units along the diagonal axis,
+ /// giving a half-tile height step of sqrt(2) * 512
+ public WDist CellHeightStep => new WDist(Grid.Type == MapGridType.RectangularIsometric ? 724 : 512);
public CPos CellContaining(WPos pos)
{
diff --git a/OpenRA.Game/Map/MapCache.cs b/OpenRA.Game/Map/MapCache.cs
index 16bf4c0da8..8e260bf4b8 100644
--- a/OpenRA.Game/Map/MapCache.cs
+++ b/OpenRA.Game/Map/MapCache.cs
@@ -335,10 +335,7 @@ namespace OpenRA
return initialUid;
}
- public MapPreview this[string key]
- {
- get { return previews[key]; }
- }
+ public MapPreview this[string key] => previews[key];
public IEnumerator GetEnumerator()
{
diff --git a/OpenRA.Game/Map/MapCoordsRegion.cs b/OpenRA.Game/Map/MapCoordsRegion.cs
index 488eafb472..d4d813330e 100644
--- a/OpenRA.Game/Map/MapCoordsRegion.cs
+++ b/OpenRA.Game/Map/MapCoordsRegion.cs
@@ -53,8 +53,8 @@ namespace OpenRA
current = new MPos(r.topLeft.U - 1, r.topLeft.V);
}
- public MPos Current { get { return current; } }
- object IEnumerator.Current { get { return Current; } }
+ public MPos Current => current;
+ object IEnumerator.Current => Current;
public void Dispose() { }
}
@@ -82,7 +82,7 @@ namespace OpenRA
return GetEnumerator();
}
- public MPos TopLeft { get { return topLeft; } }
- public MPos BottomRight { get { return bottomRight; } }
+ public MPos TopLeft => topLeft;
+ public MPos BottomRight => bottomRight;
}
}
diff --git a/OpenRA.Game/Map/MapPreview.cs b/OpenRA.Game/Map/MapPreview.cs
index 24ab5bf20e..cc9569631b 100644
--- a/OpenRA.Game/Map/MapPreview.cs
+++ b/OpenRA.Game/Map/MapPreview.cs
@@ -84,7 +84,7 @@ namespace OpenRA
public MapVisibility Visibility;
Lazy rules;
- public Ruleset Rules { get { return rules != null ? rules.Value : null; } }
+ public Ruleset Rules => rules != null ? rules.Value : null;
public bool InvalidCustomRules { get; private set; }
public bool DefinesUnsafeCustomRules { get; private set; }
public bool RulesLoaded { get; private set; }
@@ -138,23 +138,24 @@ namespace OpenRA
volatile InnerData innerData;
- public string Title { get { return innerData.Title; } }
- public string[] Categories { get { return innerData.Categories; } }
- public string Author { get { return innerData.Author; } }
- public string TileSet { get { return innerData.TileSet; } }
- public MapPlayers Players { get { return innerData.Players; } }
- public int PlayerCount { get { return innerData.PlayerCount; } }
- public CPos[] SpawnPoints { get { return innerData.SpawnPoints; } }
- public MapGridType GridType { get { return innerData.GridType; } }
- public Rectangle Bounds { get { return innerData.Bounds; } }
- public Png Preview { get { return innerData.Preview; } }
- public MapStatus Status { get { return innerData.Status; } }
- public MapClassification Class { get { return innerData.Class; } }
- public MapVisibility Visibility { get { return innerData.Visibility; } }
+ public string Title => innerData.Title;
+ public string[] Categories => innerData.Categories;
+ public string Author => innerData.Author;
+ public string TileSet => innerData.TileSet;
+ public MapPlayers Players => innerData.Players;
+ public int PlayerCount => innerData.PlayerCount;
+ public CPos[] SpawnPoints => innerData.SpawnPoints;
+ public MapGridType GridType => innerData.GridType;
+ public Rectangle Bounds => innerData.Bounds;
+ public Png Preview => innerData.Preview;
+ public MapStatus Status => innerData.Status;
+ public MapClassification Class => innerData.Class;
+ public MapVisibility Visibility => innerData.Visibility;
+
+ public Ruleset Rules => innerData.Rules;
+ public bool InvalidCustomRules => innerData.InvalidCustomRules;
+ public bool RulesLoaded => innerData.RulesLoaded;
- public Ruleset Rules { get { return innerData.Rules; } }
- public bool InvalidCustomRules { get { return innerData.InvalidCustomRules; } }
- public bool RulesLoaded { get { return innerData.RulesLoaded; } }
public bool DefinesUnsafeCustomRules
{
get
diff --git a/OpenRA.Game/Map/ProjectedCellLayer.cs b/OpenRA.Game/Map/ProjectedCellLayer.cs
index f3482fba20..76a3989ae7 100644
--- a/OpenRA.Game/Map/ProjectedCellLayer.cs
+++ b/OpenRA.Game/Map/ProjectedCellLayer.cs
@@ -15,7 +15,7 @@ namespace OpenRA
{
public sealed class ProjectedCellLayer : CellLayerBase
{
- public int MaxIndex { get { return Size.Width * Size.Height; } }
+ public int MaxIndex => Size.Width * Size.Height;
public ProjectedCellLayer(Map map)
: base(map) { }
@@ -36,29 +36,17 @@ namespace OpenRA
public T this[int index]
{
- get
- {
- return entries[index];
- }
+ get => entries[index];
- set
- {
- entries[index] = value;
- }
+ set => entries[index] = value;
}
/// Gets or sets the layer contents using projected map coordinates.
public T this[PPos uv]
{
- get
- {
- return entries[Index(uv)];
- }
+ get => entries[Index(uv)];
- set
- {
- entries[Index(uv)] = value;
- }
+ set => entries[Index(uv)] = value;
}
public bool Contains(PPos uv)
diff --git a/OpenRA.Game/Map/ProjectedCellRegion.cs b/OpenRA.Game/Map/ProjectedCellRegion.cs
index 985d892949..5426f28404 100644
--- a/OpenRA.Game/Map/ProjectedCellRegion.cs
+++ b/OpenRA.Game/Map/ProjectedCellRegion.cs
@@ -59,7 +59,7 @@ namespace OpenRA
/// this does not validate whether individual map cells are actually
/// projected inside the region.
///
- public MapCoordsRegion CandidateMapCoords { get { return new MapCoordsRegion(mapTopLeft, mapBottomRight); } }
+ public MapCoordsRegion CandidateMapCoords => new MapCoordsRegion(mapTopLeft, mapBottomRight);
public ProjectedCellRegionEnumerator GetEnumerator()
{
@@ -119,8 +119,8 @@ namespace OpenRA
v = r.TopLeft.V;
}
- public PPos Current { get { return current; } }
- object IEnumerator.Current { get { return Current; } }
+ public PPos Current => current;
+ object IEnumerator.Current => Current;
public void Dispose() { }
}
}
diff --git a/OpenRA.Game/ModData.cs b/OpenRA.Game/ModData.cs
index 7067771029..3228811b53 100644
--- a/OpenRA.Game/ModData.cs
+++ b/OpenRA.Game/ModData.cs
@@ -38,16 +38,16 @@ namespace OpenRA
public ILoadScreen LoadScreen { get; private set; }
public CursorProvider CursorProvider { get; private set; }
public FS ModFiles;
- public IReadOnlyFileSystem DefaultFileSystem { get { return ModFiles; } }
+ public IReadOnlyFileSystem DefaultFileSystem => ModFiles;
readonly Lazy defaultRules;
- public Ruleset DefaultRules { get { return defaultRules.Value; } }
+ public Ruleset DefaultRules => defaultRules.Value;
readonly Lazy> defaultTerrainInfo;
- public IReadOnlyDictionary DefaultTerrainInfo { get { return defaultTerrainInfo.Value; } }
+ public IReadOnlyDictionary DefaultTerrainInfo => defaultTerrainInfo.Value;
readonly Lazy> defaultSequences;
- public IReadOnlyDictionary DefaultSequences { get { return defaultSequences.Value; } }
+ public IReadOnlyDictionary DefaultSequences => defaultSequences.Value;
public ModData(Manifest mod, InstalledMods mods, bool useLoadScreen = false)
{
@@ -134,7 +134,7 @@ namespace OpenRA
LoadScreen.Display();
}
- internal bool IsOnMainThread { get { return System.Threading.Thread.CurrentThread.ManagedThreadId == initialThreadId; } }
+ internal bool IsOnMainThread => System.Threading.Thread.CurrentThread.ManagedThreadId == initialThreadId;
public void InitializeLoaders(IReadOnlyFileSystem fileSystem)
{
diff --git a/OpenRA.Game/Network/Connection.cs b/OpenRA.Game/Network/Connection.cs
index df20adcde8..2c9d243fcd 100644
--- a/OpenRA.Game/Network/Connection.cs
+++ b/OpenRA.Game/Network/Connection.cs
@@ -101,25 +101,13 @@ namespace OpenRA.Network
readonly List receivedPackets = new List();
public ReplayRecorder Recorder { get; private set; }
- public virtual int LocalClientId
- {
- get { return 1; }
- }
+ public virtual int LocalClientId => 1;
- public virtual ConnectionState ConnectionState
- {
- get { return ConnectionState.PreConnecting; }
- }
+ public virtual ConnectionState ConnectionState => ConnectionState.PreConnecting;
- public virtual IPEndPoint EndPoint
- {
- get { throw new NotSupportedException("An echo connection doesn't have an endpoint"); }
- }
+ public virtual IPEndPoint EndPoint => throw new NotSupportedException("An echo connection doesn't have an endpoint");
- public virtual string ErrorMessage
- {
- get { return null; }
- }
+ public virtual string ErrorMessage => null;
public virtual void Send(int frame, List orders)
{
@@ -209,9 +197,9 @@ namespace OpenRA.Network
bool disposed;
string errorMessage;
- public override IPEndPoint EndPoint { get { return endpoint; } }
+ public override IPEndPoint EndPoint => endpoint;
- public override string ErrorMessage { get { return errorMessage; } }
+ public override string ErrorMessage => errorMessage;
public NetworkConnection(ConnectionTarget target)
{
@@ -325,8 +313,8 @@ namespace OpenRA.Network
}
}
- public override int LocalClientId { get { return clientId; } }
- public override ConnectionState ConnectionState { get { return connectionState; } }
+ public override int LocalClientId => clientId;
+ public override ConnectionState ConnectionState => connectionState;
public override void SendSync(int frame, byte[] syncData)
{
diff --git a/OpenRA.Game/Network/GameServer.cs b/OpenRA.Game/Network/GameServer.cs
index f0f914a2e7..c95d2a3dce 100644
--- a/OpenRA.Game/Network/GameServer.cs
+++ b/OpenRA.Game/Network/GameServer.cs
@@ -135,7 +135,7 @@ namespace OpenRA.Network
/// The list of spawnpoints that are disabled for this game
public readonly int[] DisabledSpawnPoints = { };
- public string ModLabel { get { return "{0} ({1})".F(ModTitle, Version); } }
+ public string ModLabel => "{0} ({1})".F(ModTitle, Version);
static object LoadClients(MiniYaml yaml)
{
diff --git a/OpenRA.Game/Network/Order.cs b/OpenRA.Game/Network/Order.cs
index f1c9767295..954a446d2e 100644
--- a/OpenRA.Game/Network/Order.cs
+++ b/OpenRA.Game/Network/Order.cs
@@ -68,7 +68,7 @@ namespace OpenRA
public bool SuppressVisualFeedback;
public ref readonly Target VisualFeedbackTarget => ref visualFeedbackTarget;
- public Player Player { get { return Subject != null ? Subject.Owner : null; } }
+ public Player Player => Subject != null ? Subject.Owner : null;
readonly Target target;
readonly Target visualFeedbackTarget;
diff --git a/OpenRA.Game/Network/OrderManager.cs b/OpenRA.Game/Network/OrderManager.cs
index e0fe3392b6..11f47c1e59 100644
--- a/OpenRA.Game/Network/OrderManager.cs
+++ b/OpenRA.Game/Network/OrderManager.cs
@@ -25,7 +25,7 @@ namespace OpenRA.Network
readonly FrameData frameData = new FrameData();
public Session LobbyInfo = new Session();
- public Session.Client LocalClient { get { return LobbyInfo.ClientWithIndex(Connection.LocalClientId); } }
+ public Session.Client LocalClient => LobbyInfo.ClientWithIndex(Connection.LocalClientId);
public World World;
public readonly ConnectionTarget Endpoint;
@@ -41,7 +41,7 @@ namespace OpenRA.Network
public long LastTickTime = Game.RunTime;
- public bool GameStarted { get { return NetFrameNumber != 0; } }
+ public bool GameStarted => NetFrameNumber != 0;
public IConnection Connection { get; private set; }
internal int GameSaveLastFrame = -1;
@@ -170,10 +170,7 @@ namespace OpenRA.Network
syncForFrame.Add(frame, packet);
}
- public bool IsReadyForNextFrame
- {
- get { return GameStarted && frameData.IsReadyForFrame(NetFrameNumber); }
- }
+ public bool IsReadyForNextFrame => GameStarted && frameData.IsReadyForFrame(NetFrameNumber);
public IEnumerable GetClientsNotReadyForNextFrame
{
diff --git a/OpenRA.Game/Network/ReplayConnection.cs b/OpenRA.Game/Network/ReplayConnection.cs
index c0ecaf0d7f..81faa1a63a 100644
--- a/OpenRA.Game/Network/ReplayConnection.cs
+++ b/OpenRA.Game/Network/ReplayConnection.cs
@@ -30,14 +30,12 @@ namespace OpenRA.Network
int ordersFrame;
Dictionary lastClientsFrame = new Dictionary();
- public int LocalClientId { get { return -1; } }
- public ConnectionState ConnectionState { get { return ConnectionState.Connected; } }
- public IPEndPoint EndPoint
- {
- get { throw new NotSupportedException("A replay connection doesn't have an endpoint"); }
- }
+ public int LocalClientId => -1;
+ public ConnectionState ConnectionState => ConnectionState.Connected;
- public string ErrorMessage { get { return null; } }
+ public IPEndPoint EndPoint => throw new NotSupportedException("A replay connection doesn't have an endpoint");
+
+ public string ErrorMessage => null;
public readonly int TickCount;
public readonly int FinalGameTick;
diff --git a/OpenRA.Game/Network/Session.cs b/OpenRA.Game/Network/Session.cs
index 090b218c30..22561f2cad 100644
--- a/OpenRA.Game/Network/Session.cs
+++ b/OpenRA.Game/Network/Session.cs
@@ -149,9 +149,9 @@ namespace OpenRA.Network
public string Bot; // Bot type, null for real clients
public int BotControllerClientIndex; // who added the bot to the slot
public bool IsAdmin;
- public bool IsReady { get { return State == ClientState.Ready; } }
- public bool IsInvalid { get { return State == ClientState.Invalid; } }
- public bool IsObserver { get { return Slot == null; } }
+ public bool IsReady => State == ClientState.Ready;
+ public bool IsInvalid => State == ClientState.Invalid;
+ public bool IsObserver => Slot == null;
// Linked to the online player database
public string Fingerprint;
@@ -215,7 +215,7 @@ namespace OpenRA.Network
public string PreferredValue;
public bool IsLocked;
- public bool IsEnabled { get { return Value == "True"; } }
+ public bool IsEnabled => Value == "True";
}
public class Global
diff --git a/OpenRA.Game/Network/UPnP.cs b/OpenRA.Game/Network/UPnP.cs
index 96e2e430dd..15fd29b696 100644
--- a/OpenRA.Game/Network/UPnP.cs
+++ b/OpenRA.Game/Network/UPnP.cs
@@ -28,14 +28,9 @@ namespace OpenRA.Network
static bool initialized;
public static IPAddress ExternalIP { get; private set; }
- public static UPnPStatus Status
- {
- get
- {
- return initialized ? natDevice != null ?
- UPnPStatus.Enabled : UPnPStatus.NotSupported : UPnPStatus.Disabled;
- }
- }
+ public static UPnPStatus Status =>
+ initialized ? natDevice != null ?
+ UPnPStatus.Enabled : UPnPStatus.NotSupported : UPnPStatus.Disabled;
public static async Task DiscoverNatDevices(int timeout)
{
diff --git a/OpenRA.Game/Orders/UnitOrderGenerator.cs b/OpenRA.Game/Orders/UnitOrderGenerator.cs
index 03134b2c98..0870b10868 100644
--- a/OpenRA.Game/Orders/UnitOrderGenerator.cs
+++ b/OpenRA.Game/Orders/UnitOrderGenerator.cs
@@ -214,6 +214,6 @@ namespace OpenRA.Orders
}
}
- public virtual bool ClearSelectionOnLeftClick { get { return true; } }
+ public virtual bool ClearSelectionOnLeftClick => true;
}
}
diff --git a/OpenRA.Game/Platform.cs b/OpenRA.Game/Platform.cs
index 1de967f2f9..e89a707a85 100644
--- a/OpenRA.Game/Platform.cs
+++ b/OpenRA.Game/Platform.cs
@@ -22,7 +22,7 @@ namespace OpenRA
public static class Platform
{
- public static PlatformType CurrentPlatform { get { return currentPlatform.Value; } }
+ public static PlatformType CurrentPlatform => currentPlatform.Value;
public static readonly Guid SessionGUID = Guid.NewGuid();
static Lazy currentPlatform = Exts.Lazy(GetCurrentPlatform);
@@ -77,7 +77,7 @@ namespace OpenRA
///
/// Directory containing user-specific support files (settings, maps, replays, game data, etc).
///
- public static string SupportDir { get { return GetSupportDir(SupportDirType.User); } }
+ public static string SupportDir => GetSupportDir(SupportDirType.User);
public static string GetSupportDir(SupportDirType type)
{
diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs
index b7904ecfff..fb7c21be7c 100644
--- a/OpenRA.Game/Player.cs
+++ b/OpenRA.Game/Player.cs
@@ -77,14 +77,8 @@ namespace OpenRA
public WinState WinState = WinState.Undefined;
public bool HasObjectives = false;
- public bool Spectating
- {
- get
- {
- // Players in mission maps must not leave the player view
- return !inMissionMap && (spectating || WinState != WinState.Undefined);
- }
- }
+ // Players in mission maps must not leave the player view
+ public bool Spectating => !inMissionMap && (spectating || WinState != WinState.Undefined);
public World World { get; private set; }
@@ -301,8 +295,8 @@ namespace OpenRA
public LuaValue this[LuaRuntime runtime, LuaValue keyValue]
{
- get { return luaInterface.Value[runtime, keyValue]; }
- set { luaInterface.Value[runtime, keyValue] = value; }
+ get => luaInterface.Value[runtime, keyValue];
+ set => luaInterface.Value[runtime, keyValue] = value;
}
public LuaValue Equals(LuaRuntime runtime, LuaValue left, LuaValue right)
diff --git a/OpenRA.Game/Primitives/BitSet.cs b/OpenRA.Game/Primitives/BitSet.cs
index da34b5bf9b..9881325441 100644
--- a/OpenRA.Game/Primitives/BitSet.cs
+++ b/OpenRA.Game/Primitives/BitSet.cs
@@ -101,7 +101,7 @@ namespace OpenRA.Primitives
public override bool Equals(object obj) { return obj is BitSet && Equals((BitSet)obj); }
public override int GetHashCode() { return bits.GetHashCode(); }
- public bool IsEmpty { get { return bits == 0; } }
+ public bool IsEmpty => bits == 0;
public bool IsProperSubsetOf(BitSet other)
{
diff --git a/OpenRA.Game/Primitives/Cache.cs b/OpenRA.Game/Primitives/Cache.cs
index 359e773537..75cea420f3 100644
--- a/OpenRA.Game/Primitives/Cache.cs
+++ b/OpenRA.Game/Primitives/Cache.cs
@@ -31,18 +31,15 @@ namespace OpenRA.Primitives
public Cache(Func loader)
: this(loader, EqualityComparer.Default) { }
- public U this[T key]
- {
- get { return cache.GetOrAdd(key, loader); }
- }
+ public U this[T key] => cache.GetOrAdd(key, loader);
public bool ContainsKey(T key) { return cache.ContainsKey(key); }
public bool TryGetValue(T key, out U value) { return cache.TryGetValue(key, out value); }
- public int Count { get { return cache.Count; } }
+ public int Count => cache.Count;
public void Clear() { cache.Clear(); }
- public ICollection Keys { get { return cache.Keys; } }
- public ICollection Values { get { return cache.Values; } }
+ public ICollection Keys => cache.Keys;
+ public ICollection Values => cache.Values;
public IEnumerator> GetEnumerator() { return cache.GetEnumerator(); }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return GetEnumerator(); }
}
diff --git a/OpenRA.Game/Primitives/Color.cs b/OpenRA.Game/Primitives/Color.cs
index def4ab341b..13819d6b7e 100644
--- a/OpenRA.Game/Primitives/Color.cs
+++ b/OpenRA.Game/Primitives/Color.cs
@@ -195,10 +195,10 @@ namespace OpenRA.Primitives
return hue;
}
- public byte A { get { return (byte)(argb >> 24); } }
- public byte R { get { return (byte)(argb >> 16); } }
- public byte G { get { return (byte)(argb >> 8); } }
- public byte B { get { return (byte)argb; } }
+ public byte A => (byte)(argb >> 24);
+ public byte R => (byte)(argb >> 16);
+ public byte G => (byte)(argb >> 8);
+ public byte B => (byte)argb;
public bool Equals(Color other)
{
@@ -226,146 +226,146 @@ namespace OpenRA.Primitives
return R.ToString("X2") + G.ToString("X2") + B.ToString("X2") + A.ToString("X2");
}
- public static Color Transparent { get { return FromArgb(0x00FFFFFF); } }
- public static Color AliceBlue { get { return FromArgb(0xFFF0F8FF); } }
- public static Color AntiqueWhite { get { return FromArgb(0xFFFAEBD7); } }
- public static Color Aqua { get { return FromArgb(0xFF00FFFF); } }
- public static Color Aquamarine { get { return FromArgb(0xFF7FFFD4); } }
- public static Color Azure { get { return FromArgb(0xFFF0FFFF); } }
- public static Color Beige { get { return FromArgb(0xFFF5F5DC); } }
- public static Color Bisque { get { return FromArgb(0xFFFFE4C4); } }
- public static Color Black { get { return FromArgb(0xFF000000); } }
- public static Color BlanchedAlmond { get { return FromArgb(0xFFFFEBCD); } }
- public static Color Blue { get { return FromArgb(0xFF0000FF); } }
- public static Color BlueViolet { get { return FromArgb(0xFF8A2BE2); } }
- public static Color Brown { get { return FromArgb(0xFFA52A2A); } }
- public static Color BurlyWood { get { return FromArgb(0xFFDEB887); } }
- public static Color CadetBlue { get { return FromArgb(0xFF5F9EA0); } }
- public static Color Chartreuse { get { return FromArgb(0xFF7FFF00); } }
- public static Color Chocolate { get { return FromArgb(0xFFD2691E); } }
- public static Color Coral { get { return FromArgb(0xFFFF7F50); } }
- public static Color CornflowerBlue { get { return FromArgb(0xFF6495ED); } }
- public static Color Cornsilk { get { return FromArgb(0xFFFFF8DC); } }
- public static Color Crimson { get { return FromArgb(0xFFDC143C); } }
- public static Color Cyan { get { return FromArgb(0xFF00FFFF); } }
- public static Color DarkBlue { get { return FromArgb(0xFF00008B); } }
- public static Color DarkCyan { get { return FromArgb(0xFF008B8B); } }
- public static Color DarkGoldenrod { get { return FromArgb(0xFFB8860B); } }
- public static Color DarkGray { get { return FromArgb(0xFFA9A9A9); } }
- public static Color DarkGreen { get { return FromArgb(0xFF006400); } }
- public static Color DarkKhaki { get { return FromArgb(0xFFBDB76B); } }
- public static Color DarkMagenta { get { return FromArgb(0xFF8B008B); } }
- public static Color DarkOliveGreen { get { return FromArgb(0xFF556B2F); } }
- public static Color DarkOrange { get { return FromArgb(0xFFFF8C00); } }
- public static Color DarkOrchid { get { return FromArgb(0xFF9932CC); } }
- public static Color DarkRed { get { return FromArgb(0xFF8B0000); } }
- public static Color DarkSalmon { get { return FromArgb(0xFFE9967A); } }
- public static Color DarkSeaGreen { get { return FromArgb(0xFF8FBC8B); } }
- public static Color DarkSlateBlue { get { return FromArgb(0xFF483D8B); } }
- public static Color DarkSlateGray { get { return FromArgb(0xFF2F4F4F); } }
- public static Color DarkTurquoise { get { return FromArgb(0xFF00CED1); } }
- public static Color DarkViolet { get { return FromArgb(0xFF9400D3); } }
- public static Color DeepPink { get { return FromArgb(0xFFFF1493); } }
- public static Color DeepSkyBlue { get { return FromArgb(0xFF00BFFF); } }
- public static Color DimGray { get { return FromArgb(0xFF696969); } }
- public static Color DodgerBlue { get { return FromArgb(0xFF1E90FF); } }
- public static Color Firebrick { get { return FromArgb(0xFFB22222); } }
- public static Color FloralWhite { get { return FromArgb(0xFFFFFAF0); } }
- public static Color ForestGreen { get { return FromArgb(0xFF228B22); } }
- public static Color Fuchsia { get { return FromArgb(0xFFFF00FF); } }
- public static Color Gainsboro { get { return FromArgb(0xFFDCDCDC); } }
- public static Color GhostWhite { get { return FromArgb(0xFFF8F8FF); } }
- public static Color Gold { get { return FromArgb(0xFFFFD700); } }
- public static Color Goldenrod { get { return FromArgb(0xFFDAA520); } }
- public static Color Gray { get { return FromArgb(0xFF808080); } }
- public static Color Green { get { return FromArgb(0xFF008000); } }
- public static Color GreenYellow { get { return FromArgb(0xFFADFF2F); } }
- public static Color Honeydew { get { return FromArgb(0xFFF0FFF0); } }
- public static Color HotPink { get { return FromArgb(0xFFFF69B4); } }
- public static Color IndianRed { get { return FromArgb(0xFFCD5C5C); } }
- public static Color Indigo { get { return FromArgb(0xFF4B0082); } }
- public static Color Ivory { get { return FromArgb(0xFFFFFFF0); } }
- public static Color Khaki { get { return FromArgb(0xFFF0E68C); } }
- public static Color Lavender { get { return FromArgb(0xFFE6E6FA); } }
- public static Color LavenderBlush { get { return FromArgb(0xFFFFF0F5); } }
- public static Color LawnGreen { get { return FromArgb(0xFF7CFC00); } }
- public static Color LemonChiffon { get { return FromArgb(0xFFFFFACD); } }
- public static Color LightBlue { get { return FromArgb(0xFFADD8E6); } }
- public static Color LightCoral { get { return FromArgb(0xFFF08080); } }
- public static Color LightCyan { get { return FromArgb(0xFFE0FFFF); } }
- public static Color LightGoldenrodYellow { get { return FromArgb(0xFFFAFAD2); } }
- public static Color LightGray { get { return FromArgb(0xFFD3D3D3); } }
- public static Color LightGreen { get { return FromArgb(0xFF90EE90); } }
- public static Color LightPink { get { return FromArgb(0xFFFFB6C1); } }
- public static Color LightSalmon { get { return FromArgb(0xFFFFA07A); } }
- public static Color LightSeaGreen { get { return FromArgb(0xFF20B2AA); } }
- public static Color LightSkyBlue { get { return FromArgb(0xFF87CEFA); } }
- public static Color LightSlateGray { get { return FromArgb(0xFF778899); } }
- public static Color LightSteelBlue { get { return FromArgb(0xFFB0C4DE); } }
- public static Color LightYellow { get { return FromArgb(0xFFFFFFE0); } }
- public static Color Lime { get { return FromArgb(0xFF00FF00); } }
- public static Color LimeGreen { get { return FromArgb(0xFF32CD32); } }
- public static Color Linen { get { return FromArgb(0xFFFAF0E6); } }
- public static Color Magenta { get { return FromArgb(0xFFFF00FF); } }
- public static Color Maroon { get { return FromArgb(0xFF800000); } }
- public static Color MediumAquamarine { get { return FromArgb(0xFF66CDAA); } }
- public static Color MediumBlue { get { return FromArgb(0xFF0000CD); } }
- public static Color MediumOrchid { get { return FromArgb(0xFFBA55D3); } }
- public static Color MediumPurple { get { return FromArgb(0xFF9370DB); } }
- public static Color MediumSeaGreen { get { return FromArgb(0xFF3CB371); } }
- public static Color MediumSlateBlue { get { return FromArgb(0xFF7B68EE); } }
- public static Color MediumSpringGreen { get { return FromArgb(0xFF00FA9A); } }
- public static Color MediumTurquoise { get { return FromArgb(0xFF48D1CC); } }
- public static Color MediumVioletRed { get { return FromArgb(0xFFC71585); } }
- public static Color MidnightBlue { get { return FromArgb(0xFF191970); } }
- public static Color MintCream { get { return FromArgb(0xFFF5FFFA); } }
- public static Color MistyRose { get { return FromArgb(0xFFFFE4E1); } }
- public static Color Moccasin { get { return FromArgb(0xFFFFE4B5); } }
- public static Color NavajoWhite { get { return FromArgb(0xFFFFDEAD); } }
- public static Color Navy { get { return FromArgb(0xFF000080); } }
- public static Color OldLace { get { return FromArgb(0xFFFDF5E6); } }
- public static Color Olive { get { return FromArgb(0xFF808000); } }
- public static Color OliveDrab { get { return FromArgb(0xFF6B8E23); } }
- public static Color Orange { get { return FromArgb(0xFFFFA500); } }
- public static Color OrangeRed { get { return FromArgb(0xFFFF4500); } }
- public static Color Orchid { get { return FromArgb(0xFFDA70D6); } }
- public static Color PaleGoldenrod { get { return FromArgb(0xFFEEE8AA); } }
- public static Color PaleGreen { get { return FromArgb(0xFF98FB98); } }
- public static Color PaleTurquoise { get { return FromArgb(0xFFAFEEEE); } }
- public static Color PaleVioletRed { get { return FromArgb(0xFFDB7093); } }
- public static Color PapayaWhip { get { return FromArgb(0xFFFFEFD5); } }
- public static Color PeachPuff { get { return FromArgb(0xFFFFDAB9); } }
- public static Color Peru { get { return FromArgb(0xFFCD853F); } }
- public static Color Pink { get { return FromArgb(0xFFFFC0CB); } }
- public static Color Plum { get { return FromArgb(0xFFDDA0DD); } }
- public static Color PowderBlue { get { return FromArgb(0xFFB0E0E6); } }
- public static Color Purple { get { return FromArgb(0xFF800080); } }
- public static Color Red { get { return FromArgb(0xFFFF0000); } }
- public static Color RosyBrown { get { return FromArgb(0xFFBC8F8F); } }
- public static Color RoyalBlue { get { return FromArgb(0xFF4169E1); } }
- public static Color SaddleBrown { get { return FromArgb(0xFF8B4513); } }
- public static Color Salmon { get { return FromArgb(0xFFFA8072); } }
- public static Color SandyBrown { get { return FromArgb(0xFFF4A460); } }
- public static Color SeaGreen { get { return FromArgb(0xFF2E8B57); } }
- public static Color SeaShell { get { return FromArgb(0xFFFFF5EE); } }
- public static Color Sienna { get { return FromArgb(0xFFA0522D); } }
- public static Color Silver { get { return FromArgb(0xFFC0C0C0); } }
- public static Color SkyBlue { get { return FromArgb(0xFF87CEEB); } }
- public static Color SlateBlue { get { return FromArgb(0xFF6A5ACD); } }
- public static Color SlateGray { get { return FromArgb(0xFF708090); } }
- public static Color Snow { get { return FromArgb(0xFFFFFAFA); } }
- public static Color SpringGreen { get { return FromArgb(0xFF00FF7F); } }
- public static Color SteelBlue { get { return FromArgb(0xFF4682B4); } }
- public static Color Tan { get { return FromArgb(0xFFD2B48C); } }
- public static Color Teal { get { return FromArgb(0xFF008080); } }
- public static Color Thistle { get { return FromArgb(0xFFD8BFD8); } }
- public static Color Tomato { get { return FromArgb(0xFFFF6347); } }
- public static Color Turquoise { get { return FromArgb(0xFF40E0D0); } }
- public static Color Violet { get { return FromArgb(0xFFEE82EE); } }
- public static Color Wheat { get { return FromArgb(0xFFF5DEB3); } }
- public static Color White { get { return FromArgb(0xFFFFFFFF); } }
- public static Color WhiteSmoke { get { return FromArgb(0xFFF5F5F5); } }
- public static Color Yellow { get { return FromArgb(0xFFFFFF00); } }
- public static Color YellowGreen { get { return FromArgb(0xFF9ACD32); } }
+ public static Color Transparent => FromArgb(0x00FFFFFF);
+ public static Color AliceBlue => FromArgb(0xFFF0F8FF);
+ public static Color AntiqueWhite => FromArgb(0xFFFAEBD7);
+ public static Color Aqua => FromArgb(0xFF00FFFF);
+ public static Color Aquamarine => FromArgb(0xFF7FFFD4);
+ public static Color Azure => FromArgb(0xFFF0FFFF);
+ public static Color Beige => FromArgb(0xFFF5F5DC);
+ public static Color Bisque => FromArgb(0xFFFFE4C4);
+ public static Color Black => FromArgb(0xFF000000);
+ public static Color BlanchedAlmond => FromArgb(0xFFFFEBCD);
+ public static Color Blue => FromArgb(0xFF0000FF);
+ public static Color BlueViolet => FromArgb(0xFF8A2BE2);
+ public static Color Brown => FromArgb(0xFFA52A2A);
+ public static Color BurlyWood => FromArgb(0xFFDEB887);
+ public static Color CadetBlue => FromArgb(0xFF5F9EA0);
+ public static Color Chartreuse => FromArgb(0xFF7FFF00);
+ public static Color Chocolate => FromArgb(0xFFD2691E);
+ public static Color Coral => FromArgb(0xFFFF7F50);
+ public static Color CornflowerBlue => FromArgb(0xFF6495ED);
+ public static Color Cornsilk => FromArgb(0xFFFFF8DC);
+ public static Color Crimson => FromArgb(0xFFDC143C);
+ public static Color Cyan => FromArgb(0xFF00FFFF);
+ public static Color DarkBlue => FromArgb(0xFF00008B);
+ public static Color DarkCyan => FromArgb(0xFF008B8B);
+ public static Color DarkGoldenrod => FromArgb(0xFFB8860B);
+ public static Color DarkGray => FromArgb(0xFFA9A9A9);
+ public static Color DarkGreen => FromArgb(0xFF006400);
+ public static Color DarkKhaki => FromArgb(0xFFBDB76B);
+ public static Color DarkMagenta => FromArgb(0xFF8B008B);
+ public static Color DarkOliveGreen => FromArgb(0xFF556B2F);
+ public static Color DarkOrange => FromArgb(0xFFFF8C00);
+ public static Color DarkOrchid => FromArgb(0xFF9932CC);
+ public static Color DarkRed => FromArgb(0xFF8B0000);
+ public static Color DarkSalmon => FromArgb(0xFFE9967A);
+ public static Color DarkSeaGreen => FromArgb(0xFF8FBC8B);
+ public static Color DarkSlateBlue => FromArgb(0xFF483D8B);
+ public static Color DarkSlateGray => FromArgb(0xFF2F4F4F);
+ public static Color DarkTurquoise => FromArgb(0xFF00CED1);
+ public static Color DarkViolet => FromArgb(0xFF9400D3);
+ public static Color DeepPink => FromArgb(0xFFFF1493);
+ public static Color DeepSkyBlue => FromArgb(0xFF00BFFF);
+ public static Color DimGray => FromArgb(0xFF696969);
+ public static Color DodgerBlue => FromArgb(0xFF1E90FF);
+ public static Color Firebrick => FromArgb(0xFFB22222);
+ public static Color FloralWhite => FromArgb(0xFFFFFAF0);
+ public static Color ForestGreen => FromArgb(0xFF228B22);
+ public static Color Fuchsia => FromArgb(0xFFFF00FF);
+ public static Color Gainsboro => FromArgb(0xFFDCDCDC);
+ public static Color GhostWhite => FromArgb(0xFFF8F8FF);
+ public static Color Gold => FromArgb(0xFFFFD700);
+ public static Color Goldenrod => FromArgb(0xFFDAA520);
+ public static Color Gray => FromArgb(0xFF808080);
+ public static Color Green => FromArgb(0xFF008000);
+ public static Color GreenYellow => FromArgb(0xFFADFF2F);
+ public static Color Honeydew => FromArgb(0xFFF0FFF0);
+ public static Color HotPink => FromArgb(0xFFFF69B4);
+ public static Color IndianRed => FromArgb(0xFFCD5C5C);
+ public static Color Indigo => FromArgb(0xFF4B0082);
+ public static Color Ivory => FromArgb(0xFFFFFFF0);
+ public static Color Khaki => FromArgb(0xFFF0E68C);
+ public static Color Lavender => FromArgb(0xFFE6E6FA);
+ public static Color LavenderBlush => FromArgb(0xFFFFF0F5);
+ public static Color LawnGreen => FromArgb(0xFF7CFC00);
+ public static Color LemonChiffon => FromArgb(0xFFFFFACD);
+ public static Color LightBlue => FromArgb(0xFFADD8E6);
+ public static Color LightCoral => FromArgb(0xFFF08080);
+ public static Color LightCyan => FromArgb(0xFFE0FFFF);
+ public static Color LightGoldenrodYellow => FromArgb(0xFFFAFAD2);
+ public static Color LightGray => FromArgb(0xFFD3D3D3);
+ public static Color LightGreen => FromArgb(0xFF90EE90);
+ public static Color LightPink => FromArgb(0xFFFFB6C1);
+ public static Color LightSalmon => FromArgb(0xFFFFA07A);
+ public static Color LightSeaGreen => FromArgb(0xFF20B2AA);
+ public static Color LightSkyBlue => FromArgb(0xFF87CEFA);
+ public static Color LightSlateGray => FromArgb(0xFF778899);
+ public static Color LightSteelBlue => FromArgb(0xFFB0C4DE);
+ public static Color LightYellow => FromArgb(0xFFFFFFE0);
+ public static Color Lime => FromArgb(0xFF00FF00);
+ public static Color LimeGreen => FromArgb(0xFF32CD32);
+ public static Color Linen => FromArgb(0xFFFAF0E6);
+ public static Color Magenta => FromArgb(0xFFFF00FF);
+ public static Color Maroon => FromArgb(0xFF800000);
+ public static Color MediumAquamarine => FromArgb(0xFF66CDAA);
+ public static Color MediumBlue => FromArgb(0xFF0000CD);
+ public static Color MediumOrchid => FromArgb(0xFFBA55D3);
+ public static Color MediumPurple => FromArgb(0xFF9370DB);
+ public static Color MediumSeaGreen => FromArgb(0xFF3CB371);
+ public static Color MediumSlateBlue => FromArgb(0xFF7B68EE);
+ public static Color MediumSpringGreen => FromArgb(0xFF00FA9A);
+ public static Color MediumTurquoise => FromArgb(0xFF48D1CC);
+ public static Color MediumVioletRed => FromArgb(0xFFC71585);
+ public static Color MidnightBlue => FromArgb(0xFF191970);
+ public static Color MintCream => FromArgb(0xFFF5FFFA);
+ public static Color MistyRose => FromArgb(0xFFFFE4E1);
+ public static Color Moccasin => FromArgb(0xFFFFE4B5);
+ public static Color NavajoWhite => FromArgb(0xFFFFDEAD);
+ public static Color Navy => FromArgb(0xFF000080);
+ public static Color OldLace => FromArgb(0xFFFDF5E6);
+ public static Color Olive => FromArgb(0xFF808000);
+ public static Color OliveDrab => FromArgb(0xFF6B8E23);
+ public static Color Orange => FromArgb(0xFFFFA500);
+ public static Color OrangeRed => FromArgb(0xFFFF4500);
+ public static Color Orchid => FromArgb(0xFFDA70D6);
+ public static Color PaleGoldenrod => FromArgb(0xFFEEE8AA);
+ public static Color PaleGreen => FromArgb(0xFF98FB98);
+ public static Color PaleTurquoise => FromArgb(0xFFAFEEEE);
+ public static Color PaleVioletRed => FromArgb(0xFFDB7093);
+ public static Color PapayaWhip => FromArgb(0xFFFFEFD5);
+ public static Color PeachPuff => FromArgb(0xFFFFDAB9);
+ public static Color Peru => FromArgb(0xFFCD853F);
+ public static Color Pink => FromArgb(0xFFFFC0CB);
+ public static Color Plum => FromArgb(0xFFDDA0DD);
+ public static Color PowderBlue => FromArgb(0xFFB0E0E6);
+ public static Color Purple => FromArgb(0xFF800080);
+ public static Color Red => FromArgb(0xFFFF0000);
+ public static Color RosyBrown => FromArgb(0xFFBC8F8F);
+ public static Color RoyalBlue => FromArgb(0xFF4169E1);
+ public static Color SaddleBrown => FromArgb(0xFF8B4513);
+ public static Color Salmon => FromArgb(0xFFFA8072);
+ public static Color SandyBrown => FromArgb(0xFFF4A460);
+ public static Color SeaGreen => FromArgb(0xFF2E8B57);
+ public static Color SeaShell => FromArgb(0xFFFFF5EE);
+ public static Color Sienna => FromArgb(0xFFA0522D);
+ public static Color Silver => FromArgb(0xFFC0C0C0);
+ public static Color SkyBlue => FromArgb(0xFF87CEEB);
+ public static Color SlateBlue => FromArgb(0xFF6A5ACD);
+ public static Color SlateGray => FromArgb(0xFF708090);
+ public static Color Snow => FromArgb(0xFFFFFAFA);
+ public static Color SpringGreen => FromArgb(0xFF00FF7F);
+ public static Color SteelBlue => FromArgb(0xFF4682B4);
+ public static Color Tan => FromArgb(0xFFD2B48C);
+ public static Color Teal => FromArgb(0xFF008080);
+ public static Color Thistle => FromArgb(0xFFD8BFD8);
+ public static Color Tomato => FromArgb(0xFFFF6347);
+ public static Color Turquoise => FromArgb(0xFF40E0D0);
+ public static Color Violet => FromArgb(0xFFEE82EE);
+ public static Color Wheat => FromArgb(0xFFF5DEB3);
+ public static Color White => FromArgb(0xFFFFFFFF);
+ public static Color WhiteSmoke => FromArgb(0xFFF5F5F5);
+ public static Color Yellow => FromArgb(0xFFFFFF00);
+ public static Color YellowGreen => FromArgb(0xFF9ACD32);
}
}
diff --git a/OpenRA.Game/Primitives/ConcurrentCache.cs b/OpenRA.Game/Primitives/ConcurrentCache.cs
index c380829fce..367aea0ab1 100644
--- a/OpenRA.Game/Primitives/ConcurrentCache.cs
+++ b/OpenRA.Game/Primitives/ConcurrentCache.cs
@@ -32,16 +32,13 @@ namespace OpenRA.Primitives
public ConcurrentCache(Func loader)
: this(loader, EqualityComparer.Default) { }
- public U this[T key]
- {
- get { return cache.GetOrAdd(key, loader); }
- }
+ public U this[T key] => cache.GetOrAdd(key, loader);
public bool ContainsKey(T key) { return cache.ContainsKey(key); }
public bool TryGetValue(T key, out U value) { return cache.TryGetValue(key, out value); }
- public int Count { get { return cache.Count; } }
- public ICollection Keys { get { return cache.Keys; } }
- public ICollection Values { get { return cache.Values; } }
+ public int Count => cache.Count;
+ public ICollection Keys => cache.Keys;
+ public ICollection Values => cache.Values;
public IEnumerator> GetEnumerator() { return cache.GetEnumerator(); }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return GetEnumerator(); }
}
diff --git a/OpenRA.Game/Primitives/LongBitSet.cs b/OpenRA.Game/Primitives/LongBitSet.cs
index a8ef80ab76..ba0e958572 100644
--- a/OpenRA.Game/Primitives/LongBitSet.cs
+++ b/OpenRA.Game/Primitives/LongBitSet.cs
@@ -88,7 +88,7 @@ namespace OpenRA.Primitives
}
}
- public static long Mask { get { return allBits; } }
+ public static long Mask => allBits;
}
// Opitmized BitSet to be used only when guaranteed to be no more than 64 values.
@@ -124,7 +124,7 @@ namespace OpenRA.Primitives
public override bool Equals(object obj) { return obj is LongBitSet && Equals((LongBitSet)obj); }
public override int GetHashCode() { return bits.GetHashCode(); }
- public bool IsEmpty { get { return bits == 0; } }
+ public bool IsEmpty => bits == 0;
public bool IsProperSubsetOf(LongBitSet other)
{
diff --git a/OpenRA.Game/Primitives/MergedStream.cs b/OpenRA.Game/Primitives/MergedStream.cs
index e4dd99d6ed..51c37c116f 100644
--- a/OpenRA.Game/Primitives/MergedStream.cs
+++ b/OpenRA.Game/Primitives/MergedStream.cs
@@ -108,30 +108,18 @@ namespace OpenRA.Primitives
throw new NotSupportedException();
}
- public override bool CanRead
- {
- get { return Stream1.CanRead && Stream2.CanRead; }
- }
+ public override bool CanRead => Stream1.CanRead && Stream2.CanRead;
- public override bool CanSeek
- {
- get { return Stream1.CanSeek && Stream2.CanSeek; }
- }
+ public override bool CanSeek => Stream1.CanSeek && Stream2.CanSeek;
- public override bool CanWrite
- {
- get { return false; }
- }
+ public override bool CanWrite => false;
- public override long Length
- {
- get { return VirtualLength; }
- }
+ public override long Length => VirtualLength;
public override long Position
{
- get { return position; }
- set { Seek(value, SeekOrigin.Begin); }
+ get => position;
+ set => Seek(value, SeekOrigin.Begin);
}
}
}
diff --git a/OpenRA.Game/Primitives/ObservableCollection.cs b/OpenRA.Game/Primitives/ObservableCollection.cs
index a6a62ba993..3aaa0c5187 100644
--- a/OpenRA.Game/Primitives/ObservableCollection.cs
+++ b/OpenRA.Game/Primitives/ObservableCollection.cs
@@ -57,9 +57,6 @@ namespace OpenRA.Primitives
OnRemoveAt(this, index);
}
- public IEnumerable ObservedItems
- {
- get { return Items; }
- }
+ public IEnumerable ObservedItems => Items;
}
}
diff --git a/OpenRA.Game/Primitives/ObservableDictionary.cs b/OpenRA.Game/Primitives/ObservableDictionary.cs
index b1dce81480..a91c659f67 100644
--- a/OpenRA.Game/Primitives/ObservableDictionary.cs
+++ b/OpenRA.Game/Primitives/ObservableDictionary.cs
@@ -74,8 +74,8 @@ namespace OpenRA.Primitives
return innerDict.ContainsKey(key);
}
- public ICollection Keys { get { return innerDict.Keys; } }
- public ICollection Values { get { return innerDict.Values; } }
+ public ICollection Keys => innerDict.Keys;
+ public ICollection Values => innerDict.Values;
public bool TryGetValue(TKey key, out TValue value)
{
@@ -84,8 +84,8 @@ namespace OpenRA.Primitives
public TValue this[TKey key]
{
- get { return innerDict[key]; }
- set { innerDict[key] = value; }
+ get => innerDict[key];
+ set => innerDict[key] = value;
}
public void Clear()
@@ -94,10 +94,7 @@ namespace OpenRA.Primitives
OnRefresh(this);
}
- public int Count
- {
- get { return innerDict.Count; }
- }
+ public int Count => innerDict.Count;
public void Add(KeyValuePair item)
{
@@ -114,10 +111,7 @@ namespace OpenRA.Primitives
innerDict.CopyTo(array, arrayIndex);
}
- public bool IsReadOnly
- {
- get { return innerDict.IsReadOnly; }
- }
+ public bool IsReadOnly => innerDict.IsReadOnly;
public bool Remove(KeyValuePair item)
{
@@ -134,9 +128,6 @@ namespace OpenRA.Primitives
return innerDict.GetEnumerator();
}
- public IEnumerable ObservedItems
- {
- get { return innerDict.Keys; }
- }
+ public IEnumerable ObservedItems => innerDict.Keys;
}
}
diff --git a/OpenRA.Game/Primitives/ObservableList.cs b/OpenRA.Game/Primitives/ObservableList.cs
index aedef4fd21..978dc034c8 100644
--- a/OpenRA.Game/Primitives/ObservableList.cs
+++ b/OpenRA.Game/Primitives/ObservableList.cs
@@ -66,7 +66,7 @@ namespace OpenRA.Primitives
OnRefresh(this);
}
- public int Count { get { return innerList.Count; } }
+ public int Count => innerList.Count;
public int IndexOf(T item) { return innerList.IndexOf(item); }
public bool Contains(T item) { return innerList.Contains(item); }
@@ -78,10 +78,7 @@ namespace OpenRA.Primitives
public T this[int index]
{
- get
- {
- return innerList[index];
- }
+ get => innerList[index];
set
{
@@ -106,14 +103,8 @@ namespace OpenRA.Primitives
return innerList.GetEnumerator();
}
- public IEnumerable ObservedItems
- {
- get { return innerList; }
- }
+ public IEnumerable ObservedItems => innerList;
- public bool IsReadOnly
- {
- get { return innerList.IsReadOnly; }
- }
+ public bool IsReadOnly => innerList.IsReadOnly;
}
}
diff --git a/OpenRA.Game/Primitives/PlayerDictionary.cs b/OpenRA.Game/Primitives/PlayerDictionary.cs
index 069758bbdc..74d1cde195 100644
--- a/OpenRA.Game/Primitives/PlayerDictionary.cs
+++ b/OpenRA.Game/Primitives/PlayerDictionary.cs
@@ -46,16 +46,16 @@ namespace OpenRA.Primitives
{ }
/// Gets the value for the specified player. This is slower than specifying a player index.
- public T this[Player player] { get { return valueByPlayer[player]; } }
+ public T this[Player player] => valueByPlayer[player];
/// Gets the value for the specified player index.
- public T this[int playerIndex] { get { return valueByPlayerIndex[playerIndex]; } }
+ public T this[int playerIndex] => valueByPlayerIndex[playerIndex];
- public int Count { get { return valueByPlayerIndex.Length; } }
+ public int Count => valueByPlayerIndex.Length;
public IEnumerator GetEnumerator() { return ((IEnumerable)valueByPlayerIndex).GetEnumerator(); }
- ICollection IReadOnlyDictionary.Keys { get { return valueByPlayer.Keys; } }
- ICollection IReadOnlyDictionary.Values { get { return valueByPlayer.Values; } }
+ ICollection IReadOnlyDictionary.Keys => valueByPlayer.Keys;
+ ICollection IReadOnlyDictionary.Values => valueByPlayer.Values;
bool IReadOnlyDictionary.ContainsKey(Player key) { return valueByPlayer.ContainsKey(key); }
bool IReadOnlyDictionary.TryGetValue(Player key, out T value) { return valueByPlayer.TryGetValue(key, out value); }
IEnumerator> IEnumerable>.GetEnumerator() { return valueByPlayer.GetEnumerator(); }
diff --git a/OpenRA.Game/Primitives/Polygon.cs b/OpenRA.Game/Primitives/Polygon.cs
index 693a998d91..cf9b51b364 100644
--- a/OpenRA.Game/Primitives/Polygon.cs
+++ b/OpenRA.Game/Primitives/Polygon.cs
@@ -57,7 +57,8 @@ namespace OpenRA.Primitives
}
}
- public bool IsEmpty { get { return BoundingRect.IsEmpty; } }
+ public bool IsEmpty => BoundingRect.IsEmpty;
+
public bool Contains(int2 xy)
{
return isRectangle ? BoundingRect.Contains(xy) : Vertices.PolygonContains(xy);
diff --git a/OpenRA.Game/Primitives/PriorityQueue.cs b/OpenRA.Game/Primitives/PriorityQueue.cs
index c1c28f9f8a..79fd09c5c7 100644
--- a/OpenRA.Game/Primitives/PriorityQueue.cs
+++ b/OpenRA.Game/Primitives/PriorityQueue.cs
@@ -59,7 +59,7 @@ namespace OpenRA.Primitives
}
}
- public bool Empty { get { return level == 0; } }
+ public bool Empty => level == 0;
T At(int level, int index) { return items[level][index]; }
T Above(int level, int index) { return items[level - 1][index >> 1]; }
diff --git a/OpenRA.Game/Primitives/ReadOnlyAdapterStream.cs b/OpenRA.Game/Primitives/ReadOnlyAdapterStream.cs
index e18b035d02..84907b1647 100644
--- a/OpenRA.Game/Primitives/ReadOnlyAdapterStream.cs
+++ b/OpenRA.Game/Primitives/ReadOnlyAdapterStream.cs
@@ -35,15 +35,16 @@ namespace OpenRA.Primitives
baseStream = stream;
}
- public sealed override bool CanSeek { get { return false; } }
- public sealed override bool CanRead { get { return true; } }
- public sealed override bool CanWrite { get { return false; } }
+ public sealed override bool CanSeek => false;
+ public sealed override bool CanRead => true;
+ public sealed override bool CanWrite => false;
+
+ public override long Length => throw new NotSupportedException();
- public override long Length { get { throw new NotSupportedException(); } }
public sealed override long Position
{
- get { throw new NotSupportedException(); }
- set { throw new NotSupportedException(); }
+ get => throw new NotSupportedException();
+ set => throw new NotSupportedException();
}
public sealed override long Seek(long offset, SeekOrigin origin) { throw new NotSupportedException(); }
diff --git a/OpenRA.Game/Primitives/ReadOnlyDictionary.cs b/OpenRA.Game/Primitives/ReadOnlyDictionary.cs
index d301ca840c..ab03b63d4b 100644
--- a/OpenRA.Game/Primitives/ReadOnlyDictionary.cs
+++ b/OpenRA.Game/Primitives/ReadOnlyDictionary.cs
@@ -73,13 +73,14 @@ namespace OpenRA
return dict.TryGetValue(key, out value);
}
- public int Count { get { return dict.Count; } }
+ public int Count => dict.Count;
- public TValue this[TKey key] { get { return dict[key]; } }
+ public TValue this[TKey key] => dict[key];
- public ICollection Keys { get { return dict.Keys; } }
+ public ICollection Keys => dict.Keys;
+
+ public ICollection Values => dict.Values;
- public ICollection Values { get { return dict.Values; } }
#endregion
#region IEnumerable implementation
diff --git a/OpenRA.Game/Primitives/ReadOnlyList.cs b/OpenRA.Game/Primitives/ReadOnlyList.cs
index d505c594ed..9f32c07b32 100644
--- a/OpenRA.Game/Primitives/ReadOnlyList.cs
+++ b/OpenRA.Game/Primitives/ReadOnlyList.cs
@@ -72,9 +72,10 @@ namespace OpenRA
#endregion
#region IReadOnlyList implementation
- public int Count { get { return list.Count; } }
+ public int Count => list.Count;
+
+ public T this[int index] => list[index];
- public T this[int index] { get { return list[index]; } }
#endregion
}
}
diff --git a/OpenRA.Game/Primitives/Rectangle.cs b/OpenRA.Game/Primitives/Rectangle.cs
index 1c91907a81..f5166d526a 100644
--- a/OpenRA.Game/Primitives/Rectangle.cs
+++ b/OpenRA.Game/Primitives/Rectangle.cs
@@ -58,18 +58,18 @@ namespace OpenRA.Primitives
Height = size.Height;
}
- public int Left { get { return X; } }
- public int Right { get { return X + Width; } }
- public int Top { get { return Y; } }
- public int Bottom { get { return Y + Height; } }
- public bool IsEmpty { get { return X == 0 && Y == 0 && Width == 0 && Height == 0; } }
- public int2 Location { get { return new int2(X, Y); } }
- public Size Size { get { return new Size(Width, Height); } }
+ public int Left => X;
+ public int Right => X + Width;
+ public int Top => Y;
+ public int Bottom => Y + Height;
+ public bool IsEmpty => X == 0 && Y == 0 && Width == 0 && Height == 0;
+ public int2 Location => new int2(X, Y);
+ public Size Size => new Size(Width, Height);
- public int2 TopLeft { get { return Location; } }
- public int2 TopRight { get { return new int2(X + Width, Y); } }
- public int2 BottomLeft { get { return new int2(X, Y + Height); } }
- public int2 BottomRight { get { return new int2(X + Width, Y + Height); } }
+ public int2 TopLeft => Location;
+ public int2 TopRight => new int2(X + Width, Y);
+ public int2 BottomLeft => new int2(X, Y + Height);
+ public int2 BottomRight => new int2(X + Width, Y + Height);
public bool Contains(int x, int y)
{
diff --git a/OpenRA.Game/Primitives/SegmentStream.cs b/OpenRA.Game/Primitives/SegmentStream.cs
index e34c732460..f1bdce4f30 100644
--- a/OpenRA.Game/Primitives/SegmentStream.cs
+++ b/OpenRA.Game/Primitives/SegmentStream.cs
@@ -48,15 +48,16 @@ namespace OpenRA.Primitives
stream.Seek(BaseOffset, SeekOrigin.Begin);
}
- public override bool CanSeek { get { return true; } }
- public override bool CanRead { get { return BaseStream.CanRead; } }
- public override bool CanWrite { get { return BaseStream.CanWrite; } }
+ public override bool CanSeek => true;
+ public override bool CanRead => BaseStream.CanRead;
+ public override bool CanWrite => BaseStream.CanWrite;
+
+ public override long Length => BaseCount;
- public override long Length { get { return BaseCount; } }
public override long Position
{
- get { return BaseStream.Position - BaseOffset; }
- set { BaseStream.Position = BaseOffset + value; }
+ get => BaseStream.Position - BaseOffset;
+ set => BaseStream.Position = BaseOffset + value;
}
public override int ReadByte()
@@ -105,18 +106,18 @@ namespace OpenRA.Primitives
public override void SetLength(long value) { throw new NotSupportedException(); }
- public override bool CanTimeout { get { return BaseStream.CanTimeout; } }
+ public override bool CanTimeout => BaseStream.CanTimeout;
public override int ReadTimeout
{
- get { return BaseStream.ReadTimeout; }
- set { BaseStream.ReadTimeout = value; }
+ get => BaseStream.ReadTimeout;
+ set => BaseStream.ReadTimeout = value;
}
public override int WriteTimeout
{
- get { return BaseStream.WriteTimeout; }
- set { BaseStream.WriteTimeout = value; }
+ get => BaseStream.WriteTimeout;
+ set => BaseStream.WriteTimeout = value;
}
protected override void Dispose(bool disposing)
diff --git a/OpenRA.Game/Primitives/Size.cs b/OpenRA.Game/Primitives/Size.cs
index ce3431309b..06f05b2b33 100644
--- a/OpenRA.Game/Primitives/Size.cs
+++ b/OpenRA.Game/Primitives/Size.cs
@@ -44,7 +44,7 @@ namespace OpenRA.Primitives
Height = height;
}
- public bool IsEmpty { get { return Width == 0 && Height == 0; } }
+ public bool IsEmpty => Width == 0 && Height == 0;
public bool Equals(Size other)
{
diff --git a/OpenRA.Game/Primitives/SpatiallyPartitioned.cs b/OpenRA.Game/Primitives/SpatiallyPartitioned.cs
index 410be1e068..5b9e9172eb 100644
--- a/OpenRA.Game/Primitives/SpatiallyPartitioned.cs
+++ b/OpenRA.Game/Primitives/SpatiallyPartitioned.cs
@@ -135,8 +135,8 @@ namespace OpenRA.Primitives
}
}
- public IEnumerable ItemBounds { get { return itemBounds.Values; } }
+ public IEnumerable ItemBounds => itemBounds.Values;
- public IEnumerable Items { get { return itemBounds.Keys; } }
+ public IEnumerable Items => itemBounds.Keys;
}
}
diff --git a/OpenRA.Game/Primitives/float2.cs b/OpenRA.Game/Primitives/float2.cs
index 4fbee79c1d..bffb3d6c10 100644
--- a/OpenRA.Game/Primitives/float2.cs
+++ b/OpenRA.Game/Primitives/float2.cs
@@ -93,8 +93,8 @@ namespace OpenRA
public static float2 Max(float2 a, float2 b) { return new float2(Math.Max(a.X, b.X), Math.Max(a.Y, b.Y)); }
public static float2 Min(float2 a, float2 b) { return new float2(Math.Min(a.X, b.X), Math.Min(a.Y, b.Y)); }
- public float LengthSquared { get { return X * X + Y * Y; } }
- public float Length { get { return (float)Math.Sqrt(LengthSquared); } }
+ public float LengthSquared => X * X + Y * Y;
+ public float Length => (float)Math.Sqrt(LengthSquared);
}
public class EWMA
diff --git a/OpenRA.Game/Primitives/float3.cs b/OpenRA.Game/Primitives/float3.cs
index 5b87260286..45de826ff5 100644
--- a/OpenRA.Game/Primitives/float3.cs
+++ b/OpenRA.Game/Primitives/float3.cs
@@ -20,7 +20,7 @@ namespace OpenRA
public readonly struct float3 : IEquatable
{
public readonly float X, Y, Z;
- public float2 XY { get { return new float2(X, Y); } }
+ public float2 XY => new float2(X, Y);
public float3(float x, float y, float z) { X = x; Y = y; Z = z; }
public float3(float2 xy, float z) { X = xy.X; Y = xy.Y; Z = z; }
diff --git a/OpenRA.Game/Primitives/int2.cs b/OpenRA.Game/Primitives/int2.cs
index afcd937b55..8543ca412f 100644
--- a/OpenRA.Game/Primitives/int2.cs
+++ b/OpenRA.Game/Primitives/int2.cs
@@ -43,8 +43,8 @@ namespace OpenRA
public int2 Sign() { return new int2(Math.Sign(X), Math.Sign(Y)); }
public int2 Abs() { return new int2(Math.Abs(X), Math.Abs(Y)); }
- public int LengthSquared { get { return X * X + Y * Y; } }
- public int Length { get { return Exts.ISqrt(LengthSquared); } }
+ public int LengthSquared => X * X + Y * Y;
+ public int Length => Exts.ISqrt(LengthSquared);
public int2 WithX(int newX)
{
diff --git a/OpenRA.Game/Renderer.cs b/OpenRA.Game/Renderer.cs
index 8cf837e3bd..1101dc7fb6 100644
--- a/OpenRA.Game/Renderer.cs
+++ b/OpenRA.Game/Renderer.cs
@@ -32,13 +32,7 @@ namespace OpenRA
public SpriteRenderer SpriteRenderer { get; private set; }
public RgbaSpriteRenderer RgbaSpriteRenderer { get; private set; }
- public bool WindowHasInputFocus
- {
- get
- {
- return Window.HasInputFocus;
- }
- }
+ public bool WindowHasInputFocus => Window.HasInputFocus;
public IReadOnlyDictionary Fonts;
@@ -306,21 +300,18 @@ namespace OpenRA
CurrentBatchRenderer = null;
}
- public Size Resolution { get { return Window.EffectiveWindowSize; } }
- public Size NativeResolution { get { return Window.NativeWindowSize; } }
- public float WindowScale { get { return Window.EffectiveWindowScale; } }
- public float NativeWindowScale { get { return Window.NativeWindowScale; } }
- public GLProfile GLProfile { get { return Window.GLProfile; } }
- public GLProfile[] SupportedGLProfiles { get { return Window.SupportedGLProfiles; } }
+ public Size Resolution => Window.EffectiveWindowSize;
+ public Size NativeResolution => Window.NativeWindowSize;
+ public float WindowScale => Window.EffectiveWindowScale;
+ public float NativeWindowScale => Window.NativeWindowScale;
+ public GLProfile GLProfile => Window.GLProfile;
+ public GLProfile[] SupportedGLProfiles => Window.SupportedGLProfiles;
public interface IBatchRenderer { void Flush(); }
public IBatchRenderer CurrentBatchRenderer
{
- get
- {
- return currentBatchRenderer;
- }
+ get => currentBatchRenderer;
set
{
@@ -469,24 +460,15 @@ namespace OpenRA
return Window.SetClipboardText(text);
}
- public string GLVersion
- {
- get { return Context.GLVersion; }
- }
+ public string GLVersion => Context.GLVersion;
public IFont CreateFont(byte[] data)
{
return platform.CreateFont(data);
}
- public int DisplayCount
- {
- get { return Window.DisplayCount; }
- }
+ public int DisplayCount => Window.DisplayCount;
- public int CurrentDisplay
- {
- get { return Window.CurrentDisplay; }
- }
+ public int CurrentDisplay => Window.CurrentDisplay;
}
}
diff --git a/OpenRA.Game/Server/Connection.cs b/OpenRA.Game/Server/Connection.cs
index c28228591d..bf337587de 100644
--- a/OpenRA.Game/Server/Connection.cs
+++ b/OpenRA.Game/Server/Connection.cs
@@ -27,7 +27,7 @@ namespace OpenRA.Server
public int MostRecentFrame = 0;
public bool Validated;
- public long TimeSinceLastResponse { get { return Game.RunTime - lastReceivedTime; } }
+ public long TimeSinceLastResponse => Game.RunTime - lastReceivedTime;
public bool TimeoutMessageShown = false;
long lastReceivedTime = 0;
diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs
index c37b434970..1d45a15a84 100644
--- a/OpenRA.Game/Server/Server.cs
+++ b/OpenRA.Game/Server/Server.cs
@@ -78,8 +78,8 @@ namespace OpenRA.Server
public ServerState State
{
- get { return internalState; }
- protected set { internalState = value; }
+ get => internalState;
+ protected set => internalState = value;
}
public static void SyncClientToPlayerReference(Session.Client c, PlayerReference pr)
diff --git a/OpenRA.Game/Sound/Sound.cs b/OpenRA.Game/Sound/Sound.cs
index 7a4e2aba89..fa79e36883 100644
--- a/OpenRA.Game/Sound/Sound.cs
+++ b/OpenRA.Game/Sound/Sound.cs
@@ -200,7 +200,7 @@ namespace OpenRA
Action onMusicComplete;
public bool MusicPlaying { get; private set; }
- public MusicInfo CurrentMusic { get { return currentMusic; } }
+ public MusicInfo CurrentMusic => currentMusic;
public void PlayMusic(MusicInfo m)
{
@@ -277,10 +277,7 @@ namespace OpenRA
float soundVolumeModifier = 1.0f;
public float SoundVolumeModifier
{
- get
- {
- return soundVolumeModifier;
- }
+ get => soundVolumeModifier;
set
{
@@ -289,13 +286,11 @@ namespace OpenRA
}
}
- float InternalSoundVolume { get { return SoundVolume * soundVolumeModifier; } }
+ float InternalSoundVolume => SoundVolume * soundVolumeModifier;
+
public float SoundVolume
{
- get
- {
- return Game.Settings.Sound.SoundVolume;
- }
+ get => Game.Settings.Sound.SoundVolume;
set
{
@@ -306,10 +301,7 @@ namespace OpenRA
public float MusicVolume
{
- get
- {
- return Game.Settings.Sound.MusicVolume;
- }
+ get => Game.Settings.Sound.MusicVolume;
set
{
@@ -321,10 +313,7 @@ namespace OpenRA
public float VideoVolume
{
- get
- {
- return Game.Settings.Sound.VideoVolume;
- }
+ get => Game.Settings.Sound.VideoVolume;
set
{
@@ -334,15 +323,9 @@ namespace OpenRA
}
}
- public float MusicSeekPosition
- {
- get { return music != null ? music.SeekPosition : 0; }
- }
+ public float MusicSeekPosition => music != null ? music.SeekPosition : 0;
- public float VideoSeekPosition
- {
- get { return video != null ? video.SeekPosition : 0; }
- }
+ public float VideoSeekPosition => video != null ? video.SeekPosition : 0;
// Returns true if played successfully
public bool PlayPredefined(SoundType soundType, Ruleset ruleset, Player p, Actor voicedActor, string type, string definition, string variant,
diff --git a/OpenRA.Game/Support/Arguments.cs b/OpenRA.Game/Support/Arguments.cs
index cbb776679f..e860d45538 100644
--- a/OpenRA.Game/Support/Arguments.cs
+++ b/OpenRA.Game/Support/Arguments.cs
@@ -18,7 +18,7 @@ namespace OpenRA
{
Dictionary args = new Dictionary();
- public static Arguments Empty { get { return new Arguments(); } }
+ public static Arguments Empty => new Arguments();
public Arguments(params string[] src)
{
diff --git a/OpenRA.Game/Support/PerfTimer.cs b/OpenRA.Game/Support/PerfTimer.cs
index 722f3fe70b..27762c5101 100644
--- a/OpenRA.Game/Support/PerfTimer.cs
+++ b/OpenRA.Game/Support/PerfTimer.cs
@@ -74,7 +74,7 @@ namespace OpenRA.Support
Log.Write("perf", FormatString, ElapsedMs, Indentation + name);
}
- float ElapsedMs { get { return 1000f * ticks / Stopwatch.Frequency; } }
+ float ElapsedMs => 1000f * ticks / Stopwatch.Frequency;
public static void LogLongTick(long startStopwatchTicks, long endStopwatchTicks, string name, object item)
{
@@ -85,13 +85,7 @@ namespace OpenRA.Support
"[" + Game.LocalTick + "] " + name + ": " + label);
}
- public static long LongTickThresholdInStopwatchTicks
- {
- get
- {
- return (long)(Stopwatch.Frequency * Game.Settings.Debug.LongTickThresholdMs / 1000f);
- }
- }
+ public static long LongTickThresholdInStopwatchTicks => (long)(Stopwatch.Frequency * Game.Settings.Debug.LongTickThresholdMs / 1000f);
#region Formatting helpers
static string GetHeader(string indentation, string label)
diff --git a/OpenRA.Game/Support/VariableExpression.cs b/OpenRA.Game/Support/VariableExpression.cs
index 9224a59213..1b1c085336 100644
--- a/OpenRA.Game/Support/VariableExpression.cs
+++ b/OpenRA.Game/Support/VariableExpression.cs
@@ -24,7 +24,7 @@ namespace OpenRA.Support
public readonly string Expression;
readonly HashSet variables = new HashSet();
- public IEnumerable Variables { get { return variables; } }
+ public IEnumerable Variables => variables;
enum CharClass { Whitespace, Operator, Mixed, Id, Digit }
@@ -323,16 +323,16 @@ namespace OpenRA.Support
public readonly TokenType Type;
public readonly int Index;
- public virtual string Symbol { get { return TokenTypeInfos[(int)Type].Symbol; } }
+ public virtual string Symbol => TokenTypeInfos[(int)Type].Symbol;
- public int Precedence { get { return (int)TokenTypeInfos[(int)Type].Precedence; } }
- public Sides OperandSides { get { return TokenTypeInfos[(int)Type].OperandSides; } }
- public Associativity Associativity { get { return TokenTypeInfos[(int)Type].Associativity; } }
- public bool LeftOperand { get { return ((int)TokenTypeInfos[(int)Type].OperandSides & (int)Sides.Left) != 0; } }
- public bool RightOperand { get { return ((int)TokenTypeInfos[(int)Type].OperandSides & (int)Sides.Right) != 0; } }
+ public int Precedence => (int)TokenTypeInfos[(int)Type].Precedence;
+ public Sides OperandSides => TokenTypeInfos[(int)Type].OperandSides;
+ public Associativity Associativity => TokenTypeInfos[(int)Type].Associativity;
+ public bool LeftOperand => ((int)TokenTypeInfos[(int)Type].OperandSides & (int)Sides.Left) != 0;
+ public bool RightOperand => ((int)TokenTypeInfos[(int)Type].OperandSides & (int)Sides.Right) != 0;
- public Grouping Opens { get { return TokenTypeInfos[(int)Type].Opens; } }
- public Grouping Closes { get { return TokenTypeInfos[(int)Type].Closes; } }
+ public Grouping Opens => TokenTypeInfos[(int)Type].Opens;
+ public Grouping Closes => TokenTypeInfos[(int)Type].Closes;
public Token(TokenType type, int index)
{
@@ -559,7 +559,7 @@ namespace OpenRA.Support
{
public readonly string Name;
- public override string Symbol { get { return Name; } }
+ public override string Symbol => Name;
public VariableToken(int index, string symbol)
: base(TokenType.Variable, index) { Name = symbol; }
@@ -570,7 +570,7 @@ namespace OpenRA.Support
public readonly int Value;
readonly string symbol;
- public override string Symbol { get { return symbol; } }
+ public override string Symbol => symbol;
public NumberToken(int index, string symbol)
: base(TokenType.Number, index)
diff --git a/OpenRA.Game/TraitDictionary.cs b/OpenRA.Game/TraitDictionary.cs
index 4d91bba30d..5df5bb91cf 100644
--- a/OpenRA.Game/TraitDictionary.cs
+++ b/OpenRA.Game/TraitDictionary.cs
@@ -208,8 +208,8 @@ namespace OpenRA
public void Reset() { index = actors.BinarySearchMany(actor) - 1; }
public bool MoveNext() { return ++index < actors.Count && actors[index].ActorID == actor; }
- public T Current { get { return traits[index]; } }
- object System.Collections.IEnumerator.Current { get { return Current; } }
+ public T Current => traits[index];
+ object System.Collections.IEnumerator.Current => Current;
public void Dispose() { }
}
@@ -272,8 +272,8 @@ namespace OpenRA
public void Reset() { index = -1; }
public bool MoveNext() { return ++index < actors.Count; }
- public TraitPair Current { get { return new TraitPair(actors[index], traits[index]); } }
- object System.Collections.IEnumerator.Current { get { return Current; } }
+ public TraitPair Current => new TraitPair(actors[index], traits[index]);
+ object System.Collections.IEnumerator.Current => Current;
public void Dispose() { }
}
diff --git a/OpenRA.Game/Traits/DebugPauseState.cs b/OpenRA.Game/Traits/DebugPauseState.cs
index 98c2d1553c..c298fef6ad 100644
--- a/OpenRA.Game/Traits/DebugPauseState.cs
+++ b/OpenRA.Game/Traits/DebugPauseState.cs
@@ -21,7 +21,8 @@ namespace OpenRA.Traits
{
readonly World world;
[Sync]
- public bool Paused { get { return world.Paused; } }
+ public bool Paused => world.Paused;
+
public DebugPauseState(World world) { this.world = world; }
}
}
diff --git a/OpenRA.Game/Traits/Player/FrozenActorLayer.cs b/OpenRA.Game/Traits/Player/FrozenActorLayer.cs
index ba1fac9c5f..f9cb270e7b 100644
--- a/OpenRA.Game/Traits/Player/FrozenActorLayer.cs
+++ b/OpenRA.Game/Traits/Player/FrozenActorLayer.cs
@@ -43,7 +43,7 @@ namespace OpenRA.Traits
public Player Owner { get; private set; }
public BitSet TargetTypes { get; private set; }
- public IEnumerable TargetablePositions { get { return targetablePositions; } }
+ public IEnumerable TargetablePositions => targetablePositions;
public ITooltipInfo TooltipInfo { get; private set; }
public Player TooltipOwner { get; private set; }
@@ -108,11 +108,11 @@ namespace OpenRA.Traits
UpdateVisibility();
}
- public uint ID { get { return actor.ActorID; } }
- public bool IsValid { get { return Owner != null; } }
- public ActorInfo Info { get { return actor.Info; } }
- public Actor Actor { get { return !actor.IsDead ? actor : null; } }
- public Player Viewer { get { return viewer; } }
+ public uint ID => actor.ActorID;
+ public bool IsValid => Owner != null;
+ public ActorInfo Info => actor.Info;
+ public Actor Actor => !actor.IsDead ? actor : null;
+ public Player Viewer => viewer;
public void RefreshState()
{
@@ -198,7 +198,7 @@ namespace OpenRA.Traits
return Renderables;
}
- public bool HasRenderables { get { return !Shrouded && Renderables.Any(); } }
+ public bool HasRenderables => !Shrouded && Renderables.Any();
public override string ToString()
{
diff --git a/OpenRA.Game/Traits/Player/Shroud.cs b/OpenRA.Game/Traits/Player/Shroud.cs
index 8946514811..7bc90c8d2d 100644
--- a/OpenRA.Game/Traits/Player/Shroud.cs
+++ b/OpenRA.Game/Traits/Player/Shroud.cs
@@ -104,10 +104,7 @@ namespace OpenRA.Traits
bool disabled;
public bool Disabled
{
- get
- {
- return disabled;
- }
+ get => disabled;
set
{
@@ -119,7 +116,7 @@ namespace OpenRA.Traits
}
bool fogEnabled;
- public bool FogEnabled { get { return !Disabled && fogEnabled; } }
+ public bool FogEnabled => !Disabled && fogEnabled;
public bool ExploreMapEnabled { get; private set; }
public int Hash { get; private set; }
diff --git a/OpenRA.Game/Traits/Target.cs b/OpenRA.Game/Traits/Target.cs
index 7ae0cb05b1..5ad42ef806 100644
--- a/OpenRA.Game/Traits/Target.cs
+++ b/OpenRA.Game/Traits/Target.cs
@@ -88,8 +88,8 @@ namespace OpenRA.Traits
public static Target FromActor(Actor a) { return a != null ? new Target(a) : Invalid; }
public static Target FromFrozenActor(FrozenActor fa) { return new Target(fa); }
- public Actor Actor { get { return actor; } }
- public FrozenActor FrozenActor { get { return frozen; } }
+ public Actor Actor => actor;
+ public FrozenActor FrozenActor => frozen;
public TargetType Type
{
@@ -225,10 +225,10 @@ namespace OpenRA.Traits
}
// Expose internal state for serialization by the orders code *only*
- internal TargetType SerializableType { get { return type; } }
- internal Actor SerializableActor { get { return actor; } }
- internal CPos? SerializableCell { get { return cell; } }
- internal SubCell? SerializableSubCell { get { return subCell; } }
- internal WPos SerializablePos { get { return terrainCenterPosition; } }
+ internal TargetType SerializableType => type;
+ internal Actor SerializableActor => actor;
+ internal CPos? SerializableCell => cell;
+ internal SubCell? SerializableSubCell => subCell;
+ internal WPos SerializablePos => terrainCenterPosition;
}
}
diff --git a/OpenRA.Game/UtilityCommands/ClearInvalidModRegistrationsCommand.cs b/OpenRA.Game/UtilityCommands/ClearInvalidModRegistrationsCommand.cs
index 0b4e4a29ce..034475ee0b 100644
--- a/OpenRA.Game/UtilityCommands/ClearInvalidModRegistrationsCommand.cs
+++ b/OpenRA.Game/UtilityCommands/ClearInvalidModRegistrationsCommand.cs
@@ -15,7 +15,8 @@ namespace OpenRA.UtilityCommands
{
class ClearInvalidModRegistrationsCommand : IUtilityCommand
{
- string IUtilityCommand.Name { get { return "--clear-invalid-mod-registrations"; } }
+ string IUtilityCommand.Name => "--clear-invalid-mod-registrations";
+
bool IUtilityCommand.ValidateArguments(string[] args)
{
return args.Length >= 2 && new string[] { "system", "user", "both" }.Contains(args[1]);
diff --git a/OpenRA.Game/UtilityCommands/RegisterModCommand.cs b/OpenRA.Game/UtilityCommands/RegisterModCommand.cs
index 0b96c11483..7cc9adf529 100644
--- a/OpenRA.Game/UtilityCommands/RegisterModCommand.cs
+++ b/OpenRA.Game/UtilityCommands/RegisterModCommand.cs
@@ -15,7 +15,8 @@ namespace OpenRA.UtilityCommands
{
class RegisterModCommand : IUtilityCommand
{
- string IUtilityCommand.Name { get { return "--register-mod"; } }
+ string IUtilityCommand.Name => "--register-mod";
+
bool IUtilityCommand.ValidateArguments(string[] args)
{
return args.Length >= 3 && new string[] { "system", "user", "both" }.Contains(args[2]);
diff --git a/OpenRA.Game/UtilityCommands/UnregisterModCommand.cs b/OpenRA.Game/UtilityCommands/UnregisterModCommand.cs
index 4cab763a77..d858200c32 100644
--- a/OpenRA.Game/UtilityCommands/UnregisterModCommand.cs
+++ b/OpenRA.Game/UtilityCommands/UnregisterModCommand.cs
@@ -15,7 +15,8 @@ namespace OpenRA.UtilityCommands
{
class UnregisterModCommand : IUtilityCommand
{
- string IUtilityCommand.Name { get { return "--unregister-mod"; } }
+ string IUtilityCommand.Name => "--unregister-mod";
+
bool IUtilityCommand.ValidateArguments(string[] args)
{
return args.Length >= 2 && new string[] { "system", "user", "both" }.Contains(args[1]);
diff --git a/OpenRA.Game/WAngle.cs b/OpenRA.Game/WAngle.cs
index d38e91d86c..1ba06268b9 100644
--- a/OpenRA.Game/WAngle.cs
+++ b/OpenRA.Game/WAngle.cs
@@ -22,7 +22,7 @@ namespace OpenRA
public struct WAngle : IScriptBindable, ILuaAdditionBinding, ILuaSubtractionBinding, ILuaEqualityBinding, IEquatable
{
public readonly int Angle;
- public int AngleSquared { get { return (int)Angle * Angle; } }
+ public int AngleSquared => (int)Angle * Angle;
public WAngle(int a)
{
@@ -46,7 +46,7 @@ namespace OpenRA
public bool Equals(WAngle other) { return other == this; }
public override bool Equals(object obj) { return obj is WAngle && Equals((WAngle)obj); }
- public int Facing { get { return Angle / 4; } }
+ public int Facing => Angle / 4;
public int Sin() { return new WAngle(Angle - 256).Cos(); }
diff --git a/OpenRA.Game/WDist.cs b/OpenRA.Game/WDist.cs
index d19218be05..b14c01cac6 100644
--- a/OpenRA.Game/WDist.cs
+++ b/OpenRA.Game/WDist.cs
@@ -24,7 +24,7 @@ namespace OpenRA
public struct WDist : IComparable, IComparable, IEquatable, IScriptBindable, ILuaAdditionBinding, ILuaSubtractionBinding, ILuaEqualityBinding, ILuaTableBinding
{
public readonly int Length;
- public long LengthSquared { get { return (long)Length * Length; } }
+ public long LengthSquared => (long)Length * Length;
public WDist(int r) { Length = r; }
public static readonly WDist Zero = new WDist(0);
@@ -148,10 +148,7 @@ namespace OpenRA
}
}
- set
- {
- throw new LuaException("WDist is read-only. Use WDist.New to create a new value");
- }
+ set => throw new LuaException("WDist is read-only. Use WDist.New to create a new value");
}
#endregion
}
diff --git a/OpenRA.Game/WPos.cs b/OpenRA.Game/WPos.cs
index d879a9d938..3beb20ef41 100644
--- a/OpenRA.Game/WPos.cs
+++ b/OpenRA.Game/WPos.cs
@@ -129,10 +129,7 @@ namespace OpenRA
}
}
- set
- {
- throw new LuaException("WPos is read-only. Use WPos.New to create a new value");
- }
+ set => throw new LuaException("WPos is read-only. Use WPos.New to create a new value");
}
#endregion
diff --git a/OpenRA.Game/WVec.cs b/OpenRA.Game/WVec.cs
index 82269111ca..cee6271692 100644
--- a/OpenRA.Game/WVec.cs
+++ b/OpenRA.Game/WVec.cs
@@ -37,12 +37,12 @@ namespace OpenRA
public static bool operator !=(WVec me, WVec other) { return !(me == other); }
public static int Dot(WVec a, WVec b) { return a.X * b.X + a.Y * b.Y + a.Z * b.Z; }
- public long LengthSquared { get { return (long)X * X + (long)Y * Y + (long)Z * Z; } }
- public int Length { get { return (int)Exts.ISqrt(LengthSquared); } }
- public long HorizontalLengthSquared { get { return (long)X * X + (long)Y * Y; } }
- public int HorizontalLength { get { return (int)Exts.ISqrt(HorizontalLengthSquared); } }
- public long VerticalLengthSquared { get { return (long)Z * Z; } }
- public int VerticalLength { get { return (int)Exts.ISqrt(VerticalLengthSquared); } }
+ public long LengthSquared => (long)X * X + (long)Y * Y + (long)Z * Z;
+ public int Length => (int)Exts.ISqrt(LengthSquared);
+ public long HorizontalLengthSquared => (long)X * X + (long)Y * Y;
+ public int HorizontalLength => (int)Exts.ISqrt(HorizontalLengthSquared);
+ public long VerticalLengthSquared => (long)Z * Z;
+ public int VerticalLength => (int)Exts.ISqrt(VerticalLengthSquared);
public WVec Rotate(in WRot rot)
{
@@ -151,10 +151,7 @@ namespace OpenRA
}
}
- set
- {
- throw new LuaException("WVec is read-only. Use WVec.New to create a new value");
- }
+ set => throw new LuaException("WVec is read-only. Use WVec.New to create a new value");
}
#endregion
diff --git a/OpenRA.Game/Widgets/Widget.cs b/OpenRA.Game/Widgets/Widget.cs
index 1fc210b002..e32c114a9a 100644
--- a/OpenRA.Game/Widgets/Widget.cs
+++ b/OpenRA.Game/Widgets/Widget.cs
@@ -224,7 +224,7 @@ namespace OpenRA.Widgets
}
}
- public virtual int2 ChildOrigin { get { return RenderOrigin; } }
+ public virtual int2 ChildOrigin => RenderOrigin;
public virtual Rectangle RenderBounds
{
@@ -279,7 +279,7 @@ namespace OpenRA.Widgets
args.Remove("widget");
}
- public virtual Rectangle EventBounds { get { return RenderBounds; } }
+ public virtual Rectangle EventBounds => RenderBounds;
public virtual bool EventBoundsContains(int2 location)
{
@@ -295,8 +295,8 @@ namespace OpenRA.Widgets
return false;
}
- public bool HasMouseFocus { get { return Ui.MouseFocusWidget == this; } }
- public bool HasKeyboardFocus { get { return Ui.KeyboardFocusWidget == this; } }
+ public bool HasMouseFocus => Ui.MouseFocusWidget == this;
+ public bool HasKeyboardFocus => Ui.KeyboardFocusWidget == this;
public virtual bool TakeMouseFocus(MouseInput mi)
{
diff --git a/OpenRA.Game/World.cs b/OpenRA.Game/World.cs
index 2001bf0df2..e0bae82628 100644
--- a/OpenRA.Game/World.cs
+++ b/OpenRA.Game/World.cs
@@ -39,7 +39,7 @@ namespace OpenRA
public int Timestep;
internal readonly OrderManager OrderManager;
- public Session LobbyInfo { get { return OrderManager.LobbyInfo; } }
+ public Session LobbyInfo => OrderManager.LobbyInfo;
public readonly MersenneTwister SharedRandom;
public readonly MersenneTwister LocalRandom;
@@ -79,10 +79,7 @@ namespace OpenRA
Player renderPlayer;
public Player RenderPlayer
{
- get
- {
- return renderPlayer;
- }
+ get => renderPlayer;
set
{
@@ -103,20 +100,11 @@ namespace OpenRA
public bool ShroudObscures(WPos pos) { return RenderPlayer != null && !RenderPlayer.Shroud.IsExplored(pos); }
public bool ShroudObscures(PPos uv) { return RenderPlayer != null && !RenderPlayer.Shroud.IsExplored(uv); }
- public bool IsReplay
- {
- get { return OrderManager.Connection is ReplayConnection; }
- }
+ public bool IsReplay => OrderManager.Connection is ReplayConnection;
- public bool IsLoadingGameSave
- {
- get { return OrderManager.NetFrameNumber <= OrderManager.GameSaveLastFrame; }
- }
+ public bool IsLoadingGameSave => OrderManager.NetFrameNumber <= OrderManager.GameSaveLastFrame;
- public int GameSaveLoadingPercentage
- {
- get { return OrderManager.NetFrameNumber * 100 / OrderManager.GameSaveLastFrame; }
- }
+ public int GameSaveLoadingPercentage => OrderManager.NetFrameNumber * 100 / OrderManager.GameSaveLastFrame;
void SetLocalPlayer(Player localPlayer)
{
@@ -153,10 +141,7 @@ namespace OpenRA
IOrderGenerator orderGenerator;
public IOrderGenerator OrderGenerator
{
- get
- {
- return orderGenerator;
- }
+ get => orderGenerator;
set
{
@@ -452,10 +437,10 @@ namespace OpenRA
ScreenMap.TickRender();
}
- public IEnumerable Actors { get { return actors.Values; } }
- public IEnumerable Effects { get { return effects; } }
- public IEnumerable UnpartitionedEffects { get { return unpartitionedEffects; } }
- public IEnumerable SyncedEffects { get { return syncedEffects; } }
+ public IEnumerable Actors => actors.Values;
+ public IEnumerable Effects => effects;
+ public IEnumerable UnpartitionedEffects => unpartitionedEffects;
+ public IEnumerable SyncedEffects => syncedEffects;
public Actor GetActorById(uint actorId)
{
diff --git a/OpenRA.Mods.Cnc/AudioLoaders/AudLoader.cs b/OpenRA.Mods.Cnc/AudioLoaders/AudLoader.cs
index 5d652df4ce..662845daa6 100644
--- a/OpenRA.Mods.Cnc/AudioLoaders/AudLoader.cs
+++ b/OpenRA.Mods.Cnc/AudioLoaders/AudLoader.cs
@@ -49,10 +49,10 @@ namespace OpenRA.Mods.Cnc.AudioLoaders
public sealed class AudFormat : ISoundFormat
{
- public int Channels { get { return channels; } }
- public int SampleBits { get { return sampleBits; } }
- public int SampleRate { get { return sampleRate; } }
- public float LengthInSeconds { get { return AudReader.SoundLength(sourceStream); } }
+ public int Channels => channels;
+ public int SampleBits => sampleBits;
+ public int SampleRate => sampleRate;
+ public float LengthInSeconds => AudReader.SoundLength(sourceStream);
public Stream GetPCMInputStream() { return audStreamFactory(); }
public void Dispose() { sourceStream.Dispose(); }
diff --git a/OpenRA.Mods.Cnc/AudioLoaders/VocLoader.cs b/OpenRA.Mods.Cnc/AudioLoaders/VocLoader.cs
index ba64eb9a9e..93101ba7e4 100644
--- a/OpenRA.Mods.Cnc/AudioLoaders/VocLoader.cs
+++ b/OpenRA.Mods.Cnc/AudioLoaders/VocLoader.cs
@@ -38,10 +38,10 @@ namespace OpenRA.Mods.Cnc.AudioLoaders
public sealed class VocFormat : ISoundFormat
{
- public int SampleBits { get { return 8; } }
- public int Channels { get { return 1; } }
+ public int SampleBits => 8;
+ public int Channels => 1;
public int SampleRate { get; private set; }
- public float LengthInSeconds { get { return (float)totalSamples / SampleRate; } }
+ public float LengthInSeconds => (float)totalSamples / SampleRate;
public Stream GetPCMInputStream() { return new VocStream(new VocFormat(this)); }
public void Dispose() { stream.Dispose(); }
@@ -289,7 +289,7 @@ namespace OpenRA.Mods.Cnc.AudioLoaders
currentBlockEnded = true;
}
- bool EndOfData { get { return currentBlockEnded && samplesLeftInBlock == 0; } }
+ bool EndOfData => currentBlockEnded && samplesLeftInBlock == 0;
int FillBuffer(int maxSamples)
{
@@ -358,15 +358,16 @@ namespace OpenRA.Mods.Cnc.AudioLoaders
this.format = format;
}
- public override bool CanRead { get { return format.samplePosition < format.totalSamples; } }
- public override bool CanSeek { get { return false; } }
- public override bool CanWrite { get { return false; } }
+ public override bool CanRead => format.samplePosition < format.totalSamples;
+ public override bool CanSeek => false;
+ public override bool CanWrite => false;
+
+ public override long Length => format.totalSamples;
- public override long Length { get { return format.totalSamples; } }
public override long Position
{
- get { return format.samplePosition; }
- set { throw new NotImplementedException(); }
+ get => format.samplePosition;
+ set => throw new NotImplementedException();
}
public override int Read(byte[] buffer, int offset, int count)
diff --git a/OpenRA.Mods.Cnc/FileFormats/AudReader.cs b/OpenRA.Mods.Cnc/FileFormats/AudReader.cs
index 0a77c9f885..eaa0c3a158 100644
--- a/OpenRA.Mods.Cnc/FileFormats/AudReader.cs
+++ b/OpenRA.Mods.Cnc/FileFormats/AudReader.cs
@@ -101,10 +101,7 @@ namespace OpenRA.Mods.Cnc.FileFormats
this.dataSize = dataSize;
}
- public override long Length
- {
- get { return outputSize; }
- }
+ public override long Length => outputSize;
protected override bool BufferData(Stream baseStream, Queue data)
{
diff --git a/OpenRA.Mods.Cnc/FileFormats/VqaReader.cs b/OpenRA.Mods.Cnc/FileFormats/VqaReader.cs
index dfbfa81883..896fdec9cc 100644
--- a/OpenRA.Mods.Cnc/FileFormats/VqaReader.cs
+++ b/OpenRA.Mods.Cnc/FileFormats/VqaReader.cs
@@ -18,10 +18,10 @@ namespace OpenRA.Mods.Cnc.FileFormats
{
public class VqaReader : IVideo
{
- public ushort Frames { get { return frames; } }
- public byte Framerate { get { return framerate; } }
- public ushort Width { get { return width; } }
- public ushort Height { get { return height; } }
+ public ushort Frames => frames;
+ public byte Framerate => framerate;
+ public ushort Width => width;
+ public ushort Height => height;
readonly ushort frames;
readonly byte framerate;
@@ -65,12 +65,12 @@ namespace OpenRA.Mods.Cnc.FileFormats
byte[] audioData; // audio for this frame: 22050Hz 16bit mono pcm, uncompressed.
bool hasAudio;
- public byte[] AudioData { get { return audioData; } }
- public int CurrentFrame { get { return currentFrame; } }
- public int SampleRate { get { return sampleRate; } }
- public int SampleBits { get { return sampleBits; } }
- public int AudioChannels { get { return audioChannels; } }
- public bool HasAudio { get { return hasAudio; } }
+ public byte[] AudioData => audioData;
+ public int CurrentFrame => currentFrame;
+ public int SampleRate => sampleRate;
+ public int SampleBits => sampleBits;
+ public int AudioChannels => audioChannels;
+ public bool HasAudio => hasAudio;
public VqaReader(Stream stream)
{
@@ -513,7 +513,7 @@ namespace OpenRA.Mods.Cnc.FileFormats
}
}
- bool IsHqVqa { get { return (videoFlags & 0x10) == 16; } }
+ bool IsHqVqa => (videoFlags & 0x10) == 16;
void WriteBlock(int blockNumber, int count, ref int x, ref int y)
{
diff --git a/OpenRA.Mods.Cnc/FileSystem/BigFile.cs b/OpenRA.Mods.Cnc/FileSystem/BigFile.cs
index a8f5ad22bc..5caef1b213 100644
--- a/OpenRA.Mods.Cnc/FileSystem/BigFile.cs
+++ b/OpenRA.Mods.Cnc/FileSystem/BigFile.cs
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Cnc.FileSystem
sealed class BigFile : IReadOnlyPackage
{
public string Name { get; private set; }
- public IEnumerable Contents { get { return index.Keys; } }
+ public IEnumerable Contents => index.Keys;
readonly Dictionary index = new Dictionary();
readonly Stream s;
diff --git a/OpenRA.Mods.Cnc/FileSystem/MixFile.cs b/OpenRA.Mods.Cnc/FileSystem/MixFile.cs
index 884e8771e6..766e95ff00 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 IEnumerable Contents { get { return index.Keys; } }
+ public IEnumerable Contents => index.Keys;
readonly Dictionary index;
readonly long dataStart;
diff --git a/OpenRA.Mods.Cnc/FileSystem/Pak.cs b/OpenRA.Mods.Cnc/FileSystem/Pak.cs
index 48ac89351c..5093a92014 100644
--- a/OpenRA.Mods.Cnc/FileSystem/Pak.cs
+++ b/OpenRA.Mods.Cnc/FileSystem/Pak.cs
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Cnc.FileSystem
sealed class PakFile : IReadOnlyPackage
{
public string Name { get; private set; }
- public IEnumerable Contents { get { return index.Keys; } }
+ public IEnumerable Contents => index.Keys;
readonly Dictionary index = new Dictionary();
readonly Stream stream;
diff --git a/OpenRA.Mods.Cnc/Graphics/TeslaZapRenderable.cs b/OpenRA.Mods.Cnc/Graphics/TeslaZapRenderable.cs
index 69d69d234b..498ab09170 100644
--- a/OpenRA.Mods.Cnc/Graphics/TeslaZapRenderable.cs
+++ b/OpenRA.Mods.Cnc/Graphics/TeslaZapRenderable.cs
@@ -61,10 +61,10 @@ namespace OpenRA.Mods.Cnc.Graphics
cache = new IFinalizedRenderable[] { };
}
- public WPos Pos { get { return pos; } }
- public PaletteReference Palette { get { return null; } }
- public int ZOffset { get { return zOffset; } }
- public bool IsDecoration { get { return true; } }
+ public WPos Pos => pos;
+ public PaletteReference Palette => null;
+ public int ZOffset => zOffset;
+ public bool IsDecoration => true;
public IPalettedRenderable WithPalette(PaletteReference newPalette)
{
diff --git a/OpenRA.Mods.Cnc/Graphics/Voxel.cs b/OpenRA.Mods.Cnc/Graphics/Voxel.cs
index f90d1f3bc2..f09e274210 100644
--- a/OpenRA.Mods.Cnc/Graphics/Voxel.cs
+++ b/OpenRA.Mods.Cnc/Graphics/Voxel.cs
@@ -32,8 +32,8 @@ namespace OpenRA.Mods.Cnc.Graphics
readonly uint frames;
readonly uint limbs;
- uint IModel.Frames { get { return frames; } }
- uint IModel.Sections { get { return limbs; } }
+ uint IModel.Frames => frames;
+ uint IModel.Sections => limbs;
public Voxel(VoxelLoader loader, VxlReader vxl, HvaReader hva, (string Vxl, string Hva) files)
{
diff --git a/OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs b/OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs
index d46b1b544a..1283b666d9 100644
--- a/OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs
+++ b/OpenRA.Mods.Cnc/Graphics/VoxelModelSequenceLoader.cs
@@ -114,7 +114,7 @@ namespace OpenRA.Mods.Cnc.Graphics
return models[model].ContainsKey(sequence);
}
- public IVertexBuffer VertexBuffer { get { return loader.VertexBuffer; } }
+ public IVertexBuffer VertexBuffer => loader.VertexBuffer;
public void Dispose()
{
diff --git a/OpenRA.Mods.Cnc/SpriteLoaders/ShpD2Loader.cs b/OpenRA.Mods.Cnc/SpriteLoaders/ShpD2Loader.cs
index 2506ba6797..ccc72231ef 100644
--- a/OpenRA.Mods.Cnc/SpriteLoaders/ShpD2Loader.cs
+++ b/OpenRA.Mods.Cnc/SpriteLoaders/ShpD2Loader.cs
@@ -30,12 +30,12 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders
class ShpD2Frame : ISpriteFrame
{
- public SpriteFrameType Type { get { return SpriteFrameType.Indexed8; } }
+ public SpriteFrameType Type => SpriteFrameType.Indexed8;
public Size Size { get; private set; }
- public Size FrameSize { get { return Size; } }
- public float2 Offset { get { return float2.Zero; } }
+ public Size FrameSize => Size;
+ public float2 Offset => float2.Zero;
public byte[] Data { get; set; }
- public bool DisableExportPadding { get { return false; } }
+ public bool DisableExportPadding => false;
public ShpD2Frame(Stream s)
{
diff --git a/OpenRA.Mods.Cnc/SpriteLoaders/ShpTDLoader.cs b/OpenRA.Mods.Cnc/SpriteLoaders/ShpTDLoader.cs
index ab246d0020..d2ea0c47ca 100644
--- a/OpenRA.Mods.Cnc/SpriteLoaders/ShpTDLoader.cs
+++ b/OpenRA.Mods.Cnc/SpriteLoaders/ShpTDLoader.cs
@@ -77,12 +77,12 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders
class ImageHeader : ISpriteFrame
{
- public SpriteFrameType Type { get { return SpriteFrameType.Indexed8; } }
- public Size Size { get { return reader.Size; } }
- public Size FrameSize { get { return reader.Size; } }
- public float2 Offset { get { return float2.Zero; } }
+ public SpriteFrameType Type => SpriteFrameType.Indexed8;
+ public Size Size => reader.Size;
+ public Size FrameSize => reader.Size;
+ public float2 Offset => float2.Zero;
public byte[] Data { get; set; }
- public bool DisableExportPadding { get { return false; } }
+ public bool DisableExportPadding => false;
public uint FileOffset;
public Format Format;
diff --git a/OpenRA.Mods.Cnc/SpriteLoaders/TmpRALoader.cs b/OpenRA.Mods.Cnc/SpriteLoaders/TmpRALoader.cs
index 76b121a874..a00fde50fd 100644
--- a/OpenRA.Mods.Cnc/SpriteLoaders/TmpRALoader.cs
+++ b/OpenRA.Mods.Cnc/SpriteLoaders/TmpRALoader.cs
@@ -19,12 +19,12 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders
{
class TmpRAFrame : ISpriteFrame
{
- public SpriteFrameType Type { get { return SpriteFrameType.Indexed8; } }
+ public SpriteFrameType Type => SpriteFrameType.Indexed8;
public Size Size { get; private set; }
public Size FrameSize { get; private set; }
- public float2 Offset { get { return float2.Zero; } }
+ public float2 Offset => float2.Zero;
public byte[] Data { get; set; }
- public bool DisableExportPadding { get { return false; } }
+ public bool DisableExportPadding => false;
public TmpRAFrame(byte[] data, Size size)
{
diff --git a/OpenRA.Mods.Cnc/SpriteLoaders/TmpTDLoader.cs b/OpenRA.Mods.Cnc/SpriteLoaders/TmpTDLoader.cs
index 97b69b5251..f520923052 100644
--- a/OpenRA.Mods.Cnc/SpriteLoaders/TmpTDLoader.cs
+++ b/OpenRA.Mods.Cnc/SpriteLoaders/TmpTDLoader.cs
@@ -19,12 +19,12 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders
{
class TmpTDFrame : ISpriteFrame
{
- public SpriteFrameType Type { get { return SpriteFrameType.Indexed8; } }
+ public SpriteFrameType Type => SpriteFrameType.Indexed8;
public Size Size { get; private set; }
public Size FrameSize { get; private set; }
- public float2 Offset { get { return float2.Zero; } }
+ public float2 Offset => float2.Zero;
public byte[] Data { get; set; }
- public bool DisableExportPadding { get { return false; } }
+ public bool DisableExportPadding => false;
public TmpTDFrame(byte[] data, Size size)
{
diff --git a/OpenRA.Mods.Cnc/SpriteLoaders/TmpTSLoader.cs b/OpenRA.Mods.Cnc/SpriteLoaders/TmpTSLoader.cs
index 7569fccfff..c7a80ea3e3 100644
--- a/OpenRA.Mods.Cnc/SpriteLoaders/TmpTSLoader.cs
+++ b/OpenRA.Mods.Cnc/SpriteLoaders/TmpTSLoader.cs
@@ -21,12 +21,12 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders
{
readonly TmpTSFrame parent;
- public SpriteFrameType Type { get { return SpriteFrameType.Indexed8; } }
- public Size Size { get { return parent.Size; } }
- public Size FrameSize { get { return Size; } }
- public float2 Offset { get { return parent.Offset; } }
- public byte[] Data { get { return parent.DepthData; } }
- public bool DisableExportPadding { get { return false; } }
+ public SpriteFrameType Type => SpriteFrameType.Indexed8;
+ public Size Size => parent.Size;
+ public Size FrameSize => Size;
+ public float2 Offset => parent.Offset;
+ public byte[] Data => parent.DepthData;
+ public bool DisableExportPadding => false;
public TmpTSDepthFrame(TmpTSFrame parent)
{
@@ -36,13 +36,13 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders
class TmpTSFrame : ISpriteFrame
{
- public SpriteFrameType Type { get { return SpriteFrameType.Indexed8; } }
+ public SpriteFrameType Type => SpriteFrameType.Indexed8;
public Size Size { get; private set; }
- public Size FrameSize { get { return Size; } }
+ public Size FrameSize => Size;
public float2 Offset { get; private set; }
public byte[] Data { get; set; }
public byte[] DepthData { get; set; }
- public bool DisableExportPadding { get { return false; } }
+ public bool DisableExportPadding => false;
public TmpTSFrame(Stream s, Size size, int u, int v)
{
diff --git a/OpenRA.Mods.Cnc/Traits/Chronoshiftable.cs b/OpenRA.Mods.Cnc/Traits/Chronoshiftable.cs
index 1dfb40ad4a..c35214aa95 100644
--- a/OpenRA.Mods.Cnc/Traits/Chronoshiftable.cs
+++ b/OpenRA.Mods.Cnc/Traits/Chronoshiftable.cs
@@ -162,7 +162,7 @@ namespace OpenRA.Mods.Cnc.Traits
}
Color ISelectionBar.GetColor() { return Info.TimeBarColor; }
- bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
+ bool ISelectionBar.DisplayWhenEmpty => false;
void ModifyActorInit(TypeDictionary init)
{
diff --git a/OpenRA.Mods.Cnc/Traits/ConyardChronoReturn.cs b/OpenRA.Mods.Cnc/Traits/ConyardChronoReturn.cs
index 8e5e432886..809db155ef 100644
--- a/OpenRA.Mods.Cnc/Traits/ConyardChronoReturn.cs
+++ b/OpenRA.Mods.Cnc/Traits/ConyardChronoReturn.cs
@@ -254,6 +254,6 @@ namespace OpenRA.Mods.Cnc.Traits
}
Color ISelectionBar.GetColor() { return info.TimeBarColor; }
- bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
+ bool ISelectionBar.DisplayWhenEmpty => false;
}
}
diff --git a/OpenRA.Mods.Cnc/Traits/Disguise.cs b/OpenRA.Mods.Cnc/Traits/Disguise.cs
index 481849c405..d83dc8545c 100644
--- a/OpenRA.Mods.Cnc/Traits/Disguise.cs
+++ b/OpenRA.Mods.Cnc/Traits/Disguise.cs
@@ -37,13 +37,7 @@ namespace OpenRA.Mods.Cnc.Traits
disguise = self.Trait();
}
- public ITooltipInfo TooltipInfo
- {
- get
- {
- return disguise.Disguised ? disguise.AsTooltipInfo : Info;
- }
- }
+ public ITooltipInfo TooltipInfo => disguise.Disguised ? disguise.AsTooltipInfo : Info;
public Player Owner
{
@@ -98,7 +92,7 @@ namespace OpenRA.Mods.Cnc.Traits
public readonly string Cursor = "ability";
[GrantedConditionReference]
- public IEnumerable LinterConditions { get { return DisguisedAsConditions.Values; } }
+ public IEnumerable LinterConditions => DisguisedAsConditions.Values;
public override object Create(ActorInitializer init) { return new Disguise(init.Self, this); }
}
@@ -110,8 +104,8 @@ namespace OpenRA.Mods.Cnc.Traits
public Player AsPlayer { get; private set; }
public ITooltipInfo AsTooltipInfo { get; private set; }
- public bool Disguised { get { return AsPlayer != null; } }
- public Player Owner { get { return AsPlayer; } }
+ public bool Disguised => AsPlayer != null;
+ public Player Owner => AsPlayer;
readonly Actor self;
readonly DisguiseInfo info;
diff --git a/OpenRA.Mods.Cnc/Traits/Minelayer.cs b/OpenRA.Mods.Cnc/Traits/Minelayer.cs
index fe1fc0f2e4..673ff77da5 100644
--- a/OpenRA.Mods.Cnc/Traits/Minelayer.cs
+++ b/OpenRA.Mods.Cnc/Traits/Minelayer.cs
@@ -337,8 +337,8 @@ namespace OpenRA.Mods.Cnc.Traits
class BeginMinefieldOrderTargeter : IOrderTargeter
{
- public string OrderID { get { return "BeginMinefield"; } }
- public int OrderPriority { get { return 5; } }
+ public string OrderID => "BeginMinefield";
+ public int OrderPriority => 5;
public bool TargetOverridesSelection(Actor self, in Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
public bool CanTarget(Actor self, in Target target, List othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
diff --git a/OpenRA.Mods.Cnc/Traits/PortableChrono.cs b/OpenRA.Mods.Cnc/Traits/PortableChrono.cs
index 3e276e018d..0b700e471f 100644
--- a/OpenRA.Mods.Cnc/Traits/PortableChrono.cs
+++ b/OpenRA.Mods.Cnc/Traits/PortableChrono.cs
@@ -149,10 +149,7 @@ namespace OpenRA.Mods.Cnc.Traits
chargeTick = Info.ChargeDelay;
}
- public bool CanTeleport
- {
- get { return chargeTick <= 0; }
- }
+ public bool CanTeleport => chargeTick <= 0;
float ISelectionBar.GetValue()
{
@@ -160,7 +157,7 @@ namespace OpenRA.Mods.Cnc.Traits
}
Color ISelectionBar.GetColor() { return Color.Magenta; }
- bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
+ bool ISelectionBar.DisplayWhenEmpty => false;
}
class PortableChronoOrderTargeter : IOrderTargeter
@@ -172,8 +169,8 @@ namespace OpenRA.Mods.Cnc.Traits
this.targetCursor = targetCursor;
}
- public string OrderID { get { return "PortableChronoTeleport"; } }
- public int OrderPriority { get { return 5; } }
+ public string OrderID => "PortableChronoTeleport";
+ public int OrderPriority => 5;
public bool IsQueued { get; protected set; }
public bool TargetOverridesSelection(Actor self, in Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
diff --git a/OpenRA.Mods.Cnc/Traits/TDGunboat.cs b/OpenRA.Mods.Cnc/Traits/TDGunboat.cs
index fdab93dbb8..a788076fa3 100644
--- a/OpenRA.Mods.Cnc/Traits/TDGunboat.cs
+++ b/OpenRA.Mods.Cnc/Traits/TDGunboat.cs
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Cnc.Traits
return new ReadOnlyDictionary(occupied);
}
- bool IOccupySpaceInfo.SharesCell { get { return false; } }
+ bool IOccupySpaceInfo.SharesCell => false;
// Used to determine if actor can spawn
public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
@@ -70,19 +70,19 @@ namespace OpenRA.Mods.Cnc.Traits
[Sync]
public WAngle Facing
{
- get { return orientation.Yaw; }
- set { orientation = orientation.WithYaw(value); }
+ get => orientation.Yaw;
+ set => orientation = orientation.WithYaw(value);
}
- public WRot Orientation { get { return orientation; } }
+ public WRot Orientation => orientation;
[Sync]
public WPos CenterPosition { get; private set; }
- public CPos TopLeft { get { return self.World.Map.CellContaining(CenterPosition); } }
+ public CPos TopLeft => self.World.Map.CellContaining(CenterPosition);
// Isn't used anyway
- public WAngle TurnSpeed { get { return WAngle.Zero; } }
+ public WAngle TurnSpeed => WAngle.Zero;
CPos cachedLocation;
@@ -142,10 +142,7 @@ namespace OpenRA.Mods.Cnc.Traits
Facing = Facing == Left ? Right : Left;
}
- int MovementSpeed
- {
- get { return OpenRA.Mods.Common.Util.ApplyPercentageModifiers(Info.Speed, speedModifiers); }
- }
+ int MovementSpeed => OpenRA.Mods.Common.Util.ApplyPercentageModifiers(Info.Speed, speedModifiers);
public (CPos, SubCell)[] OccupiedCells() { return new[] { (TopLeft, SubCell.FullCell) }; }
@@ -223,7 +220,7 @@ namespace OpenRA.Mods.Cnc.Traits
public CPos NearestMoveableCell(CPos cell) { return cell; }
// Actors with TDGunboat always move
- public MovementType CurrentMovementTypes { get { return MovementType.Horizontal; } set { } }
+ public MovementType CurrentMovementTypes { get => MovementType.Horizontal; set { } }
public bool CanEnterTargetNow(Actor self, in Target target)
{
diff --git a/OpenRA.Mods.Cnc/Traits/TransferTimedExternalConditionOnTransform.cs b/OpenRA.Mods.Cnc/Traits/TransferTimedExternalConditionOnTransform.cs
index 4aaed5c566..9fcebd8316 100644
--- a/OpenRA.Mods.Cnc/Traits/TransferTimedExternalConditionOnTransform.cs
+++ b/OpenRA.Mods.Cnc/Traits/TransferTimedExternalConditionOnTransform.cs
@@ -58,6 +58,6 @@ namespace OpenRA.Mods.Cnc.Traits
this.remaining = remaining;
}
- string IConditionTimerWatcher.Condition { get { return info.Condition; } }
+ string IConditionTimerWatcher.Condition => info.Condition;
}
}
diff --git a/OpenRA.Mods.Cnc/UtilityCommands/ConvertPngToShpCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ConvertPngToShpCommand.cs
index 7430cd45e4..bc37f983ed 100644
--- a/OpenRA.Mods.Cnc/UtilityCommands/ConvertPngToShpCommand.cs
+++ b/OpenRA.Mods.Cnc/UtilityCommands/ConvertPngToShpCommand.cs
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
{
class ConvertPngToShpCommand : IUtilityCommand
{
- string IUtilityCommand.Name { get { return "--shp"; } }
+ string IUtilityCommand.Name => "--shp";
bool IUtilityCommand.ValidateArguments(string[] args)
{
diff --git a/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs
index 0e3a895435..ac223e0588 100644
--- a/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs
+++ b/OpenRA.Mods.Cnc/UtilityCommands/ImportRedAlertLegacyMapCommand.cs
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
public ImportRedAlertLegacyMapCommand()
: base(128) { }
- string IUtilityCommand.Name { get { return "--import-ra-map"; } }
+ string IUtilityCommand.Name => "--import-ra-map";
bool IUtilityCommand.ValidateArguments(string[] args) { return ValidateArguments(args); }
[Desc("FILENAME", "Convert a legacy Red Alert INI/MPR map to the OpenRA format.")]
diff --git a/OpenRA.Mods.Cnc/UtilityCommands/ImportTSMapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportTSMapCommand.cs
index 4eea50fb53..3990044d2a 100644
--- a/OpenRA.Mods.Cnc/UtilityCommands/ImportTSMapCommand.cs
+++ b/OpenRA.Mods.Cnc/UtilityCommands/ImportTSMapCommand.cs
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
{
class ImportTSMapCommand : IUtilityCommand
{
- string IUtilityCommand.Name { get { return "--import-ts-map"; } }
+ string IUtilityCommand.Name => "--import-ts-map";
bool IUtilityCommand.ValidateArguments(string[] args) { return args.Length >= 2; }
static readonly Dictionary OverlayToActor = new Dictionary()
diff --git a/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnLegacyMapCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnLegacyMapCommand.cs
index d19c783d43..0ec64a0784 100644
--- a/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnLegacyMapCommand.cs
+++ b/OpenRA.Mods.Cnc/UtilityCommands/ImportTiberianDawnLegacyMapCommand.cs
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
public ImportTiberianDawnLegacyMapCommand()
: base(64) { }
- string IUtilityCommand.Name { get { return "--import-td-map"; } }
+ string IUtilityCommand.Name => "--import-td-map";
bool IUtilityCommand.ValidateArguments(string[] args) { return ValidateArguments(args); }
[Desc("FILENAME", "Convert a legacy Tiberian Dawn INI/MPR map to the OpenRA format.")]
diff --git a/OpenRA.Mods.Cnc/UtilityCommands/LegacyRulesImporter.cs b/OpenRA.Mods.Cnc/UtilityCommands/LegacyRulesImporter.cs
index f1dfec1aa8..2f61073288 100644
--- a/OpenRA.Mods.Cnc/UtilityCommands/LegacyRulesImporter.cs
+++ b/OpenRA.Mods.Cnc/UtilityCommands/LegacyRulesImporter.cs
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
return args.Length >= 3;
}
- string IUtilityCommand.Name { get { return "--rules-import"; } }
+ string IUtilityCommand.Name => "--rules-import";
IniFile rulesIni;
IniFile artIni;
diff --git a/OpenRA.Mods.Cnc/UtilityCommands/LegacySequenceImporter.cs b/OpenRA.Mods.Cnc/UtilityCommands/LegacySequenceImporter.cs
index f79298c736..070ca15d33 100644
--- a/OpenRA.Mods.Cnc/UtilityCommands/LegacySequenceImporter.cs
+++ b/OpenRA.Mods.Cnc/UtilityCommands/LegacySequenceImporter.cs
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
return args.Length >= 2;
}
- string IUtilityCommand.Name { get { return "--sequence-import"; } }
+ string IUtilityCommand.Name => "--sequence-import";
IniFile file;
MapGrid grid;
diff --git a/OpenRA.Mods.Cnc/UtilityCommands/LegacyTilesetImporter.cs b/OpenRA.Mods.Cnc/UtilityCommands/LegacyTilesetImporter.cs
index 3ba6bfcdaa..cb2fec03c7 100644
--- a/OpenRA.Mods.Cnc/UtilityCommands/LegacyTilesetImporter.cs
+++ b/OpenRA.Mods.Cnc/UtilityCommands/LegacyTilesetImporter.cs
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
{
class ImportLegacyTilesetCommand : IUtilityCommand
{
- string IUtilityCommand.Name { get { return "--tileset-import"; } }
+ string IUtilityCommand.Name => "--tileset-import";
bool IUtilityCommand.ValidateArguments(string[] args)
{
diff --git a/OpenRA.Mods.Cnc/UtilityCommands/ListMixContentsCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/ListMixContentsCommand.cs
index 888b20345a..5a6bfd5ce5 100644
--- a/OpenRA.Mods.Cnc/UtilityCommands/ListMixContentsCommand.cs
+++ b/OpenRA.Mods.Cnc/UtilityCommands/ListMixContentsCommand.cs
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
{
class ListMixContents : IUtilityCommand
{
- string IUtilityCommand.Name { get { return "--list-mix"; } }
+ string IUtilityCommand.Name => "--list-mix";
bool IUtilityCommand.ValidateArguments(string[] args)
{
diff --git a/OpenRA.Mods.Cnc/UtilityCommands/RemapShpCommand.cs b/OpenRA.Mods.Cnc/UtilityCommands/RemapShpCommand.cs
index ac44e8c025..c219e83177 100644
--- a/OpenRA.Mods.Cnc/UtilityCommands/RemapShpCommand.cs
+++ b/OpenRA.Mods.Cnc/UtilityCommands/RemapShpCommand.cs
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
{
class RemapShpCommand : IUtilityCommand
{
- string IUtilityCommand.Name { get { return "--remap"; } }
+ string IUtilityCommand.Name => "--remap";
bool IUtilityCommand.ValidateArguments(string[] args)
{
diff --git a/OpenRA.Mods.Common/Activities/Move/MoveAdjacentTo.cs b/OpenRA.Mods.Common/Activities/Move/MoveAdjacentTo.cs
index 286d98dd45..70df3029b9 100644
--- a/OpenRA.Mods.Common/Activities/Move/MoveAdjacentTo.cs
+++ b/OpenRA.Mods.Common/Activities/Move/MoveAdjacentTo.cs
@@ -28,13 +28,7 @@ namespace OpenRA.Mods.Common.Activities
readonly DomainIndex domainIndex;
readonly Color? targetLineColor;
- protected Target Target
- {
- get
- {
- return useLastVisibleTarget ? lastVisibleTarget : target;
- }
- }
+ protected Target Target => useLastVisibleTarget ? lastVisibleTarget : target;
Target target;
Target lastVisibleTarget;
diff --git a/OpenRA.Mods.Common/ActorInitializer.cs b/OpenRA.Mods.Common/ActorInitializer.cs
index 03290c9dc3..06ffbfc345 100644
--- a/OpenRA.Mods.Common/ActorInitializer.cs
+++ b/OpenRA.Mods.Common/ActorInitializer.cs
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common
this.value = (int)value;
}
- public virtual SubCell Value { get { return (SubCell)value; } }
+ public virtual SubCell Value => (SubCell)value;
public void Initialize(MiniYaml yaml)
{
diff --git a/OpenRA.Mods.Common/AudioLoaders/WavLoader.cs b/OpenRA.Mods.Common/AudioLoaders/WavLoader.cs
index a5f93c4a29..902367619f 100644
--- a/OpenRA.Mods.Common/AudioLoaders/WavLoader.cs
+++ b/OpenRA.Mods.Common/AudioLoaders/WavLoader.cs
@@ -50,10 +50,10 @@ namespace OpenRA.Mods.Common.AudioLoaders
public sealed class WavFormat : ISoundFormat
{
- public int Channels { get { return channels; } }
- public int SampleBits { get { return sampleBits; } }
- public int SampleRate { get { return sampleRate; } }
- public float LengthInSeconds { get { return WavReader.WaveLength(sourceStream); } }
+ public int Channels => channels;
+ public int SampleBits => sampleBits;
+ public int SampleRate => sampleRate;
+ public float LengthInSeconds => WavReader.WaveLength(sourceStream);
public Stream GetPCMInputStream() { return wavStreamFactory(); }
public void Dispose() { sourceStream.Dispose(); }
diff --git a/OpenRA.Mods.Common/FileFormats/IniFile.cs b/OpenRA.Mods.Common/FileFormats/IniFile.cs
index 063e92240b..6cf500801e 100644
--- a/OpenRA.Mods.Common/FileFormats/IniFile.cs
+++ b/OpenRA.Mods.Common/FileFormats/IniFile.cs
@@ -109,7 +109,7 @@ namespace OpenRA.Mods.Common.FileFormats
throw new InvalidOperationException("Section does not exist in map or rules: " + s);
}
- public IEnumerable Sections { get { return sections.Values; } }
+ public IEnumerable Sections => sections.Values;
}
public class IniSection : IEnumerable>
diff --git a/OpenRA.Mods.Common/FileSystem/InstallShieldPackage.cs b/OpenRA.Mods.Common/FileSystem/InstallShieldPackage.cs
index f679f9eb23..a9576fabf8 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 IEnumerable Contents { get { return index.Keys; } }
+ public IEnumerable Contents => index.Keys;
readonly Dictionary index = new Dictionary();
readonly Stream s;
@@ -132,7 +132,7 @@ namespace OpenRA.Mods.Common.FileSystem
return index.ContainsKey(filename);
}
- public IReadOnlyDictionary Index { get { return new ReadOnlyDictionary(index); } }
+ public IReadOnlyDictionary Index => new ReadOnlyDictionary(index);
public void Dispose()
{
diff --git a/OpenRA.Mods.Common/Graphics/ActorPreview.cs b/OpenRA.Mods.Common/Graphics/ActorPreview.cs
index d12fc85e21..b370dbf70a 100644
--- a/OpenRA.Mods.Common/Graphics/ActorPreview.cs
+++ b/OpenRA.Mods.Common/Graphics/ActorPreview.cs
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Graphics
{
public readonly ActorInfo Actor;
public readonly WorldRenderer WorldRenderer;
- public World World { get { return WorldRenderer.World; } }
+ public World World => WorldRenderer.World;
readonly ActorReference reference;
diff --git a/OpenRA.Mods.Common/Graphics/BeamRenderable.cs b/OpenRA.Mods.Common/Graphics/BeamRenderable.cs
index 994d995a90..96e5a02a97 100644
--- a/OpenRA.Mods.Common/Graphics/BeamRenderable.cs
+++ b/OpenRA.Mods.Common/Graphics/BeamRenderable.cs
@@ -34,9 +34,9 @@ namespace OpenRA.Mods.Common.Graphics
this.color = color;
}
- public WPos Pos { get { return pos; } }
- public int ZOffset { get { return zOffset; } }
- public bool IsDecoration { get { return true; } }
+ public WPos Pos => pos;
+ public int ZOffset => zOffset;
+ public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return new BeamRenderable(pos, zOffset, length, shape, width, color); }
public IRenderable OffsetBy(WVec vec) { return new BeamRenderable(pos + vec, zOffset, length, shape, width, color); }
diff --git a/OpenRA.Mods.Common/Graphics/CircleAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/CircleAnnotationRenderable.cs
index 92a8919cae..c32c638d62 100644
--- a/OpenRA.Mods.Common/Graphics/CircleAnnotationRenderable.cs
+++ b/OpenRA.Mods.Common/Graphics/CircleAnnotationRenderable.cs
@@ -34,9 +34,9 @@ namespace OpenRA.Mods.Common.Graphics
this.filled = filled;
}
- public WPos Pos { get { return centerPosition; } }
- public int ZOffset { get { return 0; } }
- public bool IsDecoration { get { return true; } }
+ public WPos Pos => centerPosition;
+ public int ZOffset => 0;
+ public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return new CircleAnnotationRenderable(centerPosition, radius, width, color, filled); }
public IRenderable OffsetBy(WVec vec) { return new CircleAnnotationRenderable(centerPosition + vec, radius, width, color, filled); }
diff --git a/OpenRA.Mods.Common/Graphics/ContrailRenderable.cs b/OpenRA.Mods.Common/Graphics/ContrailRenderable.cs
index 939fe3c961..c4b2e2ba8c 100644
--- a/OpenRA.Mods.Common/Graphics/ContrailRenderable.cs
+++ b/OpenRA.Mods.Common/Graphics/ContrailRenderable.cs
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Graphics
{
public class ContrailRenderable : IRenderable, IFinalizedRenderable
{
- public int Length { get { return trail.Length; } }
+ public int Length => trail.Length;
readonly World world;
readonly Color color;
@@ -45,9 +45,9 @@ namespace OpenRA.Mods.Common.Graphics
this.zOffset = zOffset;
}
- public WPos Pos { get { return trail[Index(next - 1)]; } }
- public int ZOffset { get { return zOffset; } }
- public bool IsDecoration { get { return true; } }
+ public WPos Pos => trail[Index(next - 1)];
+ public int ZOffset => zOffset;
+ public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return new ContrailRenderable(world, (WPos[])trail.Clone(), width, next, length, skip, color, newOffset); }
public IRenderable OffsetBy(WVec vec) { return new ContrailRenderable(world, trail.Select(pos => pos + vec).ToArray(), width, next, length, skip, color, zOffset); }
diff --git a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs
index 11afc336e4..3c51be8132 100644
--- a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs
+++ b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs
@@ -99,21 +99,21 @@ namespace OpenRA.Mods.Common.Graphics
this.exception = exception;
}
- public string Filename { get { return exception.FileName; } }
+ public string Filename => exception.FileName;
- string ISpriteSequence.Name { get { throw exception; } }
- int ISpriteSequence.Start { get { throw exception; } }
- int ISpriteSequence.Length { get { throw exception; } }
- int ISpriteSequence.Stride { get { throw exception; } }
- int ISpriteSequence.Facings { get { throw exception; } }
- int ISpriteSequence.Tick { get { throw exception; } }
- int ISpriteSequence.ZOffset { get { throw exception; } }
- int ISpriteSequence.ShadowStart { get { throw exception; } }
- int ISpriteSequence.ShadowZOffset { get { throw exception; } }
- int[] ISpriteSequence.Frames { get { throw exception; } }
- Rectangle ISpriteSequence.Bounds { get { throw exception; } }
- bool ISpriteSequence.IgnoreWorldTint { get { throw exception; } }
- float ISpriteSequence.Scale { get { throw exception; } }
+ string ISpriteSequence.Name => throw exception;
+ int ISpriteSequence.Start => throw exception;
+ int ISpriteSequence.Length => throw exception;
+ int ISpriteSequence.Stride => throw exception;
+ int ISpriteSequence.Facings => throw exception;
+ int ISpriteSequence.Tick => throw exception;
+ int ISpriteSequence.ZOffset => throw exception;
+ int ISpriteSequence.ShadowStart => throw exception;
+ int ISpriteSequence.ShadowZOffset => throw exception;
+ int[] ISpriteSequence.Frames => throw exception;
+ Rectangle ISpriteSequence.Bounds => throw exception;
+ bool ISpriteSequence.IgnoreWorldTint => throw exception;
+ float ISpriteSequence.Scale => throw exception;
Sprite ISpriteSequence.GetSprite(int frame) { throw exception; }
Sprite ISpriteSequence.GetSprite(int frame, WAngle facing) { throw exception; }
Sprite ISpriteSequence.GetShadow(int frame, WAngle facing) { throw exception; }
diff --git a/OpenRA.Mods.Common/Graphics/DetectionCircleAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/DetectionCircleAnnotationRenderable.cs
index f3a4309f51..b871192330 100644
--- a/OpenRA.Mods.Common/Graphics/DetectionCircleAnnotationRenderable.cs
+++ b/OpenRA.Mods.Common/Graphics/DetectionCircleAnnotationRenderable.cs
@@ -42,9 +42,9 @@ namespace OpenRA.Mods.Common.Graphics
this.borderWidth = borderWidth;
}
- public WPos Pos { get { return centerPosition; } }
- public int ZOffset { get { return zOffset; } }
- public bool IsDecoration { get { return true; } }
+ public WPos Pos => centerPosition;
+ public int ZOffset => zOffset;
+ public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset)
{
diff --git a/OpenRA.Mods.Common/Graphics/IsometricSelectionBarsAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/IsometricSelectionBarsAnnotationRenderable.cs
index e16cade155..718f0405ac 100644
--- a/OpenRA.Mods.Common/Graphics/IsometricSelectionBarsAnnotationRenderable.cs
+++ b/OpenRA.Mods.Common/Graphics/IsometricSelectionBarsAnnotationRenderable.cs
@@ -46,12 +46,12 @@ namespace OpenRA.Mods.Common.Graphics
this.bounds = bounds;
}
- public WPos Pos { get { return pos; } }
- public bool DisplayHealth { get { return displayHealth; } }
- public bool DisplayExtra { get { return displayExtra; } }
+ public WPos Pos => pos;
+ public bool DisplayHealth => displayHealth;
+ public bool DisplayExtra => displayExtra;
- public int ZOffset { get { return 0; } }
- public bool IsDecoration { get { return true; } }
+ public int ZOffset => 0;
+ public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return this; }
public IRenderable OffsetBy(WVec vec) { return new IsometricSelectionBarsAnnotationRenderable(pos + vec, actor, bounds); }
diff --git a/OpenRA.Mods.Common/Graphics/IsometricSelectionBoxAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/IsometricSelectionBoxAnnotationRenderable.cs
index 6ec5e0f9d6..520d7bead3 100644
--- a/OpenRA.Mods.Common/Graphics/IsometricSelectionBoxAnnotationRenderable.cs
+++ b/OpenRA.Mods.Common/Graphics/IsometricSelectionBoxAnnotationRenderable.cs
@@ -48,10 +48,10 @@ namespace OpenRA.Mods.Common.Graphics
this.color = color;
}
- public WPos Pos { get { return pos; } }
+ public WPos Pos => pos;
- public int ZOffset { get { return 0; } }
- public bool IsDecoration { get { return true; } }
+ public int ZOffset => 0;
+ public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return this; }
public IRenderable OffsetBy(WVec vec) { return new IsometricSelectionBoxAnnotationRenderable(pos + vec, bounds, color); }
diff --git a/OpenRA.Mods.Common/Graphics/LineAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/LineAnnotationRenderable.cs
index b2ae99417e..ffaa20b0a1 100644
--- a/OpenRA.Mods.Common/Graphics/LineAnnotationRenderable.cs
+++ b/OpenRA.Mods.Common/Graphics/LineAnnotationRenderable.cs
@@ -39,9 +39,9 @@ namespace OpenRA.Mods.Common.Graphics
this.endColor = endColor;
}
- public WPos Pos { get { return start; } }
- public int ZOffset { get { return 0; } }
- public bool IsDecoration { get { return true; } }
+ public WPos Pos => start;
+ public int ZOffset => 0;
+ public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return new LineAnnotationRenderable(start, end, width, startColor, endColor); }
public IRenderable OffsetBy(WVec vec) { return new LineAnnotationRenderable(start + vec, end + vec, width, startColor, endColor); }
diff --git a/OpenRA.Mods.Common/Graphics/ModelRenderable.cs b/OpenRA.Mods.Common/Graphics/ModelRenderable.cs
index d2443ca639..7f5e3a57ef 100644
--- a/OpenRA.Mods.Common/Graphics/ModelRenderable.cs
+++ b/OpenRA.Mods.Common/Graphics/ModelRenderable.cs
@@ -65,14 +65,14 @@ namespace OpenRA.Mods.Common.Graphics
this.tintModifiers = tintModifiers;
}
- public WPos Pos { get { return pos; } }
- public PaletteReference Palette { get { return palette; } }
- public int ZOffset { get { return zOffset; } }
- public bool IsDecoration { get { return false; } }
+ public WPos Pos => pos;
+ public PaletteReference Palette => palette;
+ public int ZOffset => zOffset;
+ public bool IsDecoration => false;
- public float Alpha { get { return alpha; } }
- public float3 Tint { get { return tint; } }
- public TintModifiers TintModifiers { get { return tintModifiers; } }
+ public float Alpha => alpha;
+ public float3 Tint => tint;
+ public TintModifiers TintModifiers => tintModifiers;
public IPalettedRenderable WithPalette(PaletteReference newPalette)
{
diff --git a/OpenRA.Mods.Common/Graphics/PolygonAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/PolygonAnnotationRenderable.cs
index 3185e132c9..d70600596f 100644
--- a/OpenRA.Mods.Common/Graphics/PolygonAnnotationRenderable.cs
+++ b/OpenRA.Mods.Common/Graphics/PolygonAnnotationRenderable.cs
@@ -30,9 +30,9 @@ namespace OpenRA.Mods.Common.Graphics
this.color = color;
}
- public WPos Pos { get { return effectivePos; } }
- public int ZOffset { get { return 0; } }
- public bool IsDecoration { get { return true; } }
+ public WPos Pos => effectivePos;
+ public int ZOffset => 0;
+ public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return new PolygonAnnotationRenderable(vertices, effectivePos, width, color); }
public IRenderable OffsetBy(WVec vec) { return new PolygonAnnotationRenderable(vertices.Select(v => v + vec).ToArray(), effectivePos + vec, width, color); }
diff --git a/OpenRA.Mods.Common/Graphics/RailgunRenderable.cs b/OpenRA.Mods.Common/Graphics/RailgunRenderable.cs
index db1f521149..5d6bbda416 100644
--- a/OpenRA.Mods.Common/Graphics/RailgunRenderable.cs
+++ b/OpenRA.Mods.Common/Graphics/RailgunRenderable.cs
@@ -40,9 +40,9 @@ namespace OpenRA.Mods.Common.Graphics
angle = new WAngle(ticks * info.HelixAngleDeltaPerTick.Angle);
}
- public WPos Pos { get { return pos; } }
- public int ZOffset { get { return zOffset; } }
- public bool IsDecoration { get { return true; } }
+ public WPos Pos => pos;
+ public int ZOffset => zOffset;
+ public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return new RailgunHelixRenderable(pos, newOffset, railgun, info, ticks); }
public IRenderable OffsetBy(WVec vec) { return new RailgunHelixRenderable(pos + vec, zOffset, railgun, info, ticks); }
diff --git a/OpenRA.Mods.Common/Graphics/RangeCircleAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/RangeCircleAnnotationRenderable.cs
index d5e0af5a12..4939e7b60e 100644
--- a/OpenRA.Mods.Common/Graphics/RangeCircleAnnotationRenderable.cs
+++ b/OpenRA.Mods.Common/Graphics/RangeCircleAnnotationRenderable.cs
@@ -39,9 +39,9 @@ namespace OpenRA.Mods.Common.Graphics
this.borderWidth = borderWidth;
}
- public WPos Pos { get { return centerPosition; } }
- public int ZOffset { get { return zOffset; } }
- public bool IsDecoration { get { return true; } }
+ public WPos Pos => centerPosition;
+ public int ZOffset => zOffset;
+ public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return new RangeCircleAnnotationRenderable(centerPosition, radius, newOffset, color, width, borderColor, borderWidth); }
public IRenderable OffsetBy(WVec vec) { return new RangeCircleAnnotationRenderable(centerPosition + vec, radius, zOffset, color, width, borderColor, borderWidth); }
diff --git a/OpenRA.Mods.Common/Graphics/SelectionBarsAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/SelectionBarsAnnotationRenderable.cs
index f4f49e510f..626073c0ac 100644
--- a/OpenRA.Mods.Common/Graphics/SelectionBarsAnnotationRenderable.cs
+++ b/OpenRA.Mods.Common/Graphics/SelectionBarsAnnotationRenderable.cs
@@ -37,12 +37,12 @@ namespace OpenRA.Mods.Common.Graphics
this.decorationBounds = decorationBounds;
}
- public WPos Pos { get { return pos; } }
- public bool DisplayHealth { get { return displayHealth; } }
- public bool DisplayExtra { get { return displayExtra; } }
+ public WPos Pos => pos;
+ public bool DisplayHealth => displayHealth;
+ public bool DisplayExtra => displayExtra;
- public int ZOffset { get { return 0; } }
- public bool IsDecoration { get { return true; } }
+ public int ZOffset => 0;
+ public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return this; }
public IRenderable OffsetBy(WVec vec) { return new SelectionBarsAnnotationRenderable(pos + vec, actor, decorationBounds); }
diff --git a/OpenRA.Mods.Common/Graphics/SelectionBoxAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/SelectionBoxAnnotationRenderable.cs
index 26f048c351..9ae16c64e3 100644
--- a/OpenRA.Mods.Common/Graphics/SelectionBoxAnnotationRenderable.cs
+++ b/OpenRA.Mods.Common/Graphics/SelectionBoxAnnotationRenderable.cs
@@ -30,10 +30,10 @@ namespace OpenRA.Mods.Common.Graphics
this.color = color;
}
- public WPos Pos { get { return pos; } }
+ public WPos Pos => pos;
- public int ZOffset { get { return 0; } }
- public bool IsDecoration { get { return true; } }
+ public int ZOffset => 0;
+ public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return this; }
public IRenderable OffsetBy(WVec vec) { return new SelectionBoxAnnotationRenderable(pos + vec, decorationBounds, color); }
diff --git a/OpenRA.Mods.Common/Graphics/TextAnnotationRenderable.cs b/OpenRA.Mods.Common/Graphics/TextAnnotationRenderable.cs
index 8cdf0861ac..83cb6a405e 100644
--- a/OpenRA.Mods.Common/Graphics/TextAnnotationRenderable.cs
+++ b/OpenRA.Mods.Common/Graphics/TextAnnotationRenderable.cs
@@ -42,9 +42,9 @@ namespace OpenRA.Mods.Common.Graphics
ChromeMetrics.Get("TextContrastColorLight"),
text) { }
- public WPos Pos { get { return pos; } }
- public int ZOffset { get { return zOffset; } }
- public bool IsDecoration { get { return true; } }
+ public WPos Pos => pos;
+ public int ZOffset => zOffset;
+ public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return new TextAnnotationRenderable(font, pos, zOffset, color, text); }
public IRenderable OffsetBy(WVec vec) { return new TextAnnotationRenderable(font, pos + vec, zOffset, color, text); }
diff --git a/OpenRA.Mods.Common/Graphics/UIModelRenderable.cs b/OpenRA.Mods.Common/Graphics/UIModelRenderable.cs
index d17643e5f9..8a549bb9b5 100644
--- a/OpenRA.Mods.Common/Graphics/UIModelRenderable.cs
+++ b/OpenRA.Mods.Common/Graphics/UIModelRenderable.cs
@@ -51,10 +51,10 @@ namespace OpenRA.Mods.Common.Graphics
shadowPalette = shadow;
}
- public WPos Pos { get { return effectiveWorldPos; } }
- public PaletteReference Palette { get { return palette; } }
- public int ZOffset { get { return zOffset; } }
- public bool IsDecoration { get { return false; } }
+ public WPos Pos => effectiveWorldPos;
+ public PaletteReference Palette => palette;
+ public int ZOffset => zOffset;
+ public bool IsDecoration => false;
public IPalettedRenderable WithPalette(PaletteReference newPalette)
{
diff --git a/OpenRA.Mods.Common/Graphics/UITextRenderable.cs b/OpenRA.Mods.Common/Graphics/UITextRenderable.cs
index d8a744ec99..5bc02e494a 100644
--- a/OpenRA.Mods.Common/Graphics/UITextRenderable.cs
+++ b/OpenRA.Mods.Common/Graphics/UITextRenderable.cs
@@ -44,9 +44,9 @@ namespace OpenRA.Mods.Common.Graphics
ChromeMetrics.Get("TextContrastColorLight"),
text) { }
- public WPos Pos { get { return effectiveWorldPos; } }
- public int ZOffset { get { return zOffset; } }
- public bool IsDecoration { get { return true; } }
+ public WPos Pos => effectiveWorldPos;
+ public int ZOffset => zOffset;
+ public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return new UITextRenderable(font, effectiveWorldPos, screenPos, zOffset, color, text); }
public IRenderable OffsetBy(WVec vec) { return new UITextRenderable(font, effectiveWorldPos + vec, screenPos, zOffset, color, text); }
diff --git a/OpenRA.Mods.Common/HitShapes/Circle.cs b/OpenRA.Mods.Common/HitShapes/Circle.cs
index 25fa6de0fa..03abb8c1c8 100644
--- a/OpenRA.Mods.Common/HitShapes/Circle.cs
+++ b/OpenRA.Mods.Common/HitShapes/Circle.cs
@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.HitShapes
{
public class CircleShape : IHitShape
{
- public WDist OuterRadius { get { return Radius; } }
+ public WDist OuterRadius => Radius;
[FieldLoader.Require]
public readonly WDist Radius = new WDist(426);
diff --git a/OpenRA.Mods.Common/Orders/GuardOrderGenerator.cs b/OpenRA.Mods.Common/Orders/GuardOrderGenerator.cs
index 86a20f6a24..7a6e7e42ac 100644
--- a/OpenRA.Mods.Common/Orders/GuardOrderGenerator.cs
+++ b/OpenRA.Mods.Common/Orders/GuardOrderGenerator.cs
@@ -78,7 +78,7 @@ namespace OpenRA.Mods.Common.Orders
return true;
}
- public override bool ClearSelectionOnLeftClick { get { return false; } }
+ public override bool ClearSelectionOnLeftClick => false;
static IEnumerable FriendlyGuardableUnits(World world, MouseInput mi)
{
diff --git a/OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs b/OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs
index b081eb6e15..c5e8fbbbe2 100644
--- a/OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs
+++ b/OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Pathfinder
public abstract IEnumerable<(CPos Cell, int Cost)> Considered { get; }
- public Player Owner { get { return Graph.Actor.Owner; } }
+ public Player Owner => Graph.Actor.Owner;
public int MaxCost { get; protected set; }
public bool Debug { get; set; }
protected Func heuristic;
@@ -176,7 +176,7 @@ namespace OpenRA.Mods.Common.Pathfinder
return isGoal(location);
}
- public bool CanExpand { get { return !OpenQueue.Empty; } }
+ public bool CanExpand => !OpenQueue.Empty;
public abstract CPos Expand();
protected virtual void Dispose(bool disposing)
diff --git a/OpenRA.Mods.Common/Pathfinder/PathGraph.cs b/OpenRA.Mods.Common/Pathfinder/PathGraph.cs
index 175a8d06c0..4edb22fd52 100644
--- a/OpenRA.Mods.Common/Pathfinder/PathGraph.cs
+++ b/OpenRA.Mods.Common/Pathfinder/PathGraph.cs
@@ -222,8 +222,8 @@ namespace OpenRA.Mods.Common.Pathfinder
public CellInfo this[CPos pos]
{
- get { return (pos.Layer == 0 ? groundInfo : customLayerInfo[pos.Layer].Info)[pos]; }
- set { (pos.Layer == 0 ? groundInfo : customLayerInfo[pos.Layer].Info)[pos] = value; }
+ get => (pos.Layer == 0 ? groundInfo : customLayerInfo[pos.Layer].Info)[pos];
+ set => (pos.Layer == 0 ? groundInfo : customLayerInfo[pos.Layer].Info)[pos] = value;
}
public void Dispose()
diff --git a/OpenRA.Mods.Common/Pathfinder/PathSearch.cs b/OpenRA.Mods.Common/Pathfinder/PathSearch.cs
index 45d6653894..82770e32d6 100644
--- a/OpenRA.Mods.Common/Pathfinder/PathSearch.cs
+++ b/OpenRA.Mods.Common/Pathfinder/PathSearch.cs
@@ -30,10 +30,7 @@ namespace OpenRA.Mods.Common.Pathfinder
return LayerPoolTable.GetValue(world, CreateLayerPool);
}
- public override IEnumerable<(CPos, int)> Considered
- {
- get { return considered; }
- }
+ public override IEnumerable<(CPos, int)> Considered => considered;
LinkedList<(CPos, int)> considered;
diff --git a/OpenRA.Mods.Common/Projectiles/AreaBeam.cs b/OpenRA.Mods.Common/Projectiles/AreaBeam.cs
index cc594caf74..8f14afda46 100644
--- a/OpenRA.Mods.Common/Projectiles/AreaBeam.cs
+++ b/OpenRA.Mods.Common/Projectiles/AreaBeam.cs
@@ -103,13 +103,7 @@ namespace OpenRA.Mods.Common.Projectiles
bool isTailTravelling;
bool continueTracking = true;
- bool IsBeamComplete
- {
- get
- {
- return !isHeadTravelling && headTicks >= length && !isTailTravelling && tailTicks >= length;
- }
- }
+ bool IsBeamComplete => !isHeadTravelling && headTicks >= length && !isTailTravelling && tailTicks >= length;
public AreaBeam(AreaBeamInfo info, ProjectileArgs args, Color color)
{
diff --git a/OpenRA.Mods.Common/Projectiles/NukeLaunch.cs b/OpenRA.Mods.Common/Projectiles/NukeLaunch.cs
index 84d60aba53..7cb39e7bf6 100644
--- a/OpenRA.Mods.Common/Projectiles/NukeLaunch.cs
+++ b/OpenRA.Mods.Common/Projectiles/NukeLaunch.cs
@@ -159,6 +159,6 @@ namespace OpenRA.Mods.Common.Effects
return anim.Render(pos, wr.Palette(weaponPalette));
}
- public float FractionComplete { get { return ticks * 1f / impactDelay; } }
+ public float FractionComplete => ticks * 1f / impactDelay;
}
}
diff --git a/OpenRA.Mods.Common/Scripting/Global/AngleGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/AngleGlobal.cs
index 7815611098..0b54e5358a 100644
--- a/OpenRA.Mods.Common/Scripting/Global/AngleGlobal.cs
+++ b/OpenRA.Mods.Common/Scripting/Global/AngleGlobal.cs
@@ -19,14 +19,14 @@ namespace OpenRA.Mods.Common.Scripting.Global
public AngleGlobal(ScriptContext context)
: base(context) { }
- public WAngle North { get { return WAngle.Zero; } }
- public WAngle NorthWest { get { return new WAngle(128); } }
- public WAngle West { get { return new WAngle(256); } }
- public WAngle SouthWest { get { return new WAngle(384); } }
- public WAngle South { get { return new WAngle(512); } }
- public WAngle SouthEast { get { return new WAngle(640); } }
- public WAngle East { get { return new WAngle(768); } }
- public WAngle NorthEast { get { return new WAngle(896); } }
+ public WAngle North => WAngle.Zero;
+ public WAngle NorthWest => new WAngle(128);
+ public WAngle West => new WAngle(256);
+ public WAngle SouthWest => new WAngle(384);
+ public WAngle South => new WAngle(512);
+ public WAngle SouthEast => new WAngle(640);
+ public WAngle East => new WAngle(768);
+ public WAngle NorthEast => new WAngle(896);
[Desc("Create an arbitrary angle.")]
public WAngle New(int a) { return new WAngle(a); }
diff --git a/OpenRA.Mods.Common/Scripting/Global/CameraGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/CameraGlobal.cs
index 66ec0c33b9..6ce1c60a8c 100644
--- a/OpenRA.Mods.Common/Scripting/Global/CameraGlobal.cs
+++ b/OpenRA.Mods.Common/Scripting/Global/CameraGlobal.cs
@@ -22,8 +22,8 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("The center of the visible viewport.")]
public WPos Position
{
- get { return Context.WorldRenderer.Viewport.CenterPosition; }
- set { Context.WorldRenderer.Viewport.Center(value); }
+ get => Context.WorldRenderer.Viewport.CenterPosition;
+ set => Context.WorldRenderer.Viewport.Center(value);
}
}
}
diff --git a/OpenRA.Mods.Common/Scripting/Global/ColorGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/ColorGlobal.cs
index e008b3ac82..2b6f9fb337 100644
--- a/OpenRA.Mods.Common/Scripting/Global/ColorGlobal.cs
+++ b/OpenRA.Mods.Common/Scripting/Global/ColorGlobal.cs
@@ -51,41 +51,41 @@ namespace OpenRA.Mods.Common.Scripting.Global
throw new LuaException("Invalid rrggbb[aa] hex string.");
}
- public Color Aqua { get { return Color.Aqua; } }
- public Color Black { get { return Color.Black; } }
- public Color Blue { get { return Color.Blue; } }
- public Color Brown { get { return Color.Brown; } }
- public Color Cyan { get { return Color.Cyan; } }
- public Color DarkBlue { get { return Color.DarkBlue; } }
- public Color DarkCyan { get { return Color.DarkCyan; } }
- public Color DarkGray { get { return Color.DarkGray; } }
- public Color DarkGreen { get { return Color.DarkGreen; } }
- public Color DarkOrange { get { return Color.DarkOrange; } }
- public Color DarkRed { get { return Color.DarkRed; } }
- public Color Fuchsia { get { return Color.Fuchsia; } }
- public Color Gold { get { return Color.Gold; } }
- public Color Gray { get { return Color.Gray; } }
- public Color Green { get { return Color.Green; } }
- public Color LawnGreen { get { return Color.LawnGreen; } }
- public Color LightBlue { get { return Color.LightBlue; } }
- public Color LightCyan { get { return Color.LightCyan; } }
- public Color LightGray { get { return Color.LightGray; } }
- public Color LightGreen { get { return Color.LightGreen; } }
- public Color LightYellow { get { return Color.LightYellow; } }
- public Color Lime { get { return Color.Lime; } }
- public Color LimeGreen { get { return Color.LimeGreen; } }
- public Color Magenta { get { return Color.Magenta; } }
- public Color Maroon { get { return Color.Maroon; } }
- public Color Navy { get { return Color.Navy; } }
- public Color Olive { get { return Color.Olive; } }
- public Color Orange { get { return Color.Orange; } }
- public Color OrangeRed { get { return Color.OrangeRed; } }
- public Color Purple { get { return Color.Purple; } }
- public Color Red { get { return Color.Red; } }
- public Color Salmon { get { return Color.Salmon; } }
- public Color SkyBlue { get { return Color.SkyBlue; } }
- public Color Teal { get { return Color.Teal; } }
- public Color Yellow { get { return Color.Yellow; } }
- public Color White { get { return Color.White; } }
+ public Color Aqua => Color.Aqua;
+ public Color Black => Color.Black;
+ public Color Blue => Color.Blue;
+ public Color Brown => Color.Brown;
+ public Color Cyan => Color.Cyan;
+ public Color DarkBlue => Color.DarkBlue;
+ public Color DarkCyan => Color.DarkCyan;
+ public Color DarkGray => Color.DarkGray;
+ public Color DarkGreen => Color.DarkGreen;
+ public Color DarkOrange => Color.DarkOrange;
+ public Color DarkRed => Color.DarkRed;
+ public Color Fuchsia => Color.Fuchsia;
+ public Color Gold => Color.Gold;
+ public Color Gray => Color.Gray;
+ public Color Green => Color.Green;
+ public Color LawnGreen => Color.LawnGreen;
+ public Color LightBlue => Color.LightBlue;
+ public Color LightCyan => Color.LightCyan;
+ public Color LightGray => Color.LightGray;
+ public Color LightGreen => Color.LightGreen;
+ public Color LightYellow => Color.LightYellow;
+ public Color Lime => Color.Lime;
+ public Color LimeGreen => Color.LimeGreen;
+ public Color Magenta => Color.Magenta;
+ public Color Maroon => Color.Maroon;
+ public Color Navy => Color.Navy;
+ public Color Olive => Color.Olive;
+ public Color Orange => Color.Orange;
+ public Color OrangeRed => Color.OrangeRed;
+ public Color Purple => Color.Purple;
+ public Color Red => Color.Red;
+ public Color Salmon => Color.Salmon;
+ public Color SkyBlue => Color.SkyBlue;
+ public Color Teal => Color.Teal;
+ public Color Yellow => Color.Yellow;
+ public Color White => Color.White;
}
}
diff --git a/OpenRA.Mods.Common/Scripting/Global/CoordinateGlobals.cs b/OpenRA.Mods.Common/Scripting/Global/CoordinateGlobals.cs
index 7a7f7ed5bd..88e0b6a90c 100644
--- a/OpenRA.Mods.Common/Scripting/Global/CoordinateGlobals.cs
+++ b/OpenRA.Mods.Common/Scripting/Global/CoordinateGlobals.cs
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Scripting
public CPos New(int x, int y) { return new CPos(x, y); }
[Desc("The cell coordinate origin.")]
- public CPos Zero { get { return CPos.Zero; } }
+ public CPos Zero => CPos.Zero;
}
[ScriptGlobal("CVec")]
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Scripting
public CVec New(int x, int y) { return new CVec(x, y); }
[Desc("The cell zero-vector.")]
- public CVec Zero { get { return CVec.Zero; } }
+ public CVec Zero => CVec.Zero;
}
[ScriptGlobal("WPos")]
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Scripting
public WPos New(int x, int y, int z) { return new WPos(x, y, z); }
[Desc("The world coordinate origin.")]
- public WPos Zero { get { return WPos.Zero; } }
+ public WPos Zero => WPos.Zero;
}
[ScriptGlobal("WVec")]
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Scripting
public WVec New(int x, int y, int z) { return new WVec(x, y, z); }
[Desc("The world zero-vector.")]
- public WVec Zero { get { return WVec.Zero; } }
+ public WVec Zero => WVec.Zero;
}
[ScriptGlobal("WDist")]
diff --git a/OpenRA.Mods.Common/Scripting/Global/DateTimeGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/DateTimeGlobal.cs
index 8b8f45435b..5f7e372c96 100644
--- a/OpenRA.Mods.Common/Scripting/Global/DateTimeGlobal.cs
+++ b/OpenRA.Mods.Common/Scripting/Global/DateTimeGlobal.cs
@@ -28,16 +28,10 @@ namespace OpenRA.Mods.Common.Scripting
}
[Desc("True on the 31st of October.")]
- public bool IsHalloween
- {
- get { return DateTime.Today.Month == 10 && DateTime.Today.Day == 31; }
- }
+ public bool IsHalloween => DateTime.Today.Month == 10 && DateTime.Today.Day == 31;
[Desc("Get the current game time (in ticks).")]
- public int GameTime
- {
- get { return Context.World.WorldTick; }
- }
+ public int GameTime => Context.World.WorldTick;
[Desc("Converts the number of seconds into game time (ticks).")]
public int Seconds(int seconds)
@@ -54,10 +48,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Return or set the time limit (in ticks). When setting, the time limit will count from now. Setting the time limit to 0 will disable it.")]
public int TimeLimit
{
- get
- {
- return tlm != null ? tlm.TimeLimit : 0;
- }
+ get => tlm != null ? tlm.TimeLimit : 0;
set
{
@@ -71,10 +62,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("The notification string used for custom time limit warnings. See the TimeLimitManager trait documentation for details.")]
public string TimeLimitNotification
{
- get
- {
- return tlm != null ? tlm.Notification : null;
- }
+ get => tlm != null ? tlm.Notification : null;
set
{
diff --git a/OpenRA.Mods.Common/Scripting/Global/LightingGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/LightingGlobal.cs
index f82a0ab883..4f237f6f77 100644
--- a/OpenRA.Mods.Common/Scripting/Global/LightingGlobal.cs
+++ b/OpenRA.Mods.Common/Scripting/Global/LightingGlobal.cs
@@ -40,25 +40,25 @@ namespace OpenRA.Mods.Common.Scripting
public double Red
{
- get { return hasLighting ? lighting.Red : 1d; }
+ get => hasLighting ? lighting.Red : 1d;
set { if (hasLighting) lighting.Red = (float)value; }
}
public double Green
{
- get { return hasLighting ? lighting.Green : 1d; }
+ get => hasLighting ? lighting.Green : 1d;
set { if (hasLighting) lighting.Green = (float)value; }
}
public double Blue
{
- get { return hasLighting ? lighting.Blue : 1d; }
+ get => hasLighting ? lighting.Blue : 1d;
set { if (hasLighting) lighting.Blue = (float)value; }
}
public double Ambient
{
- get { return hasLighting ? lighting.Ambient : 1d; }
+ get => hasLighting ? lighting.Ambient : 1d;
set { if (hasLighting) lighting.Ambient = (float)value; }
}
}
diff --git a/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs
index c85d4f1b6c..92d5b870aa 100644
--- a/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs
+++ b/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs
@@ -49,27 +49,15 @@ namespace OpenRA.Mods.Common.Scripting
return FilteredObjects(actors, filter).ToArray();
}
+ // HACK: This api method abuses the coordinate system, and should be removed
+ // in favour of proper actor queries. See #8549.
[Desc("Returns the location of the top-left corner of the map (assuming zero terrain height).")]
- public WPos TopLeft
- {
- get
- {
- // HACK: This api method abuses the coordinate system, and should be removed
- // in favour of proper actor queries. See #8549.
- return Context.World.Map.ProjectedTopLeft;
- }
- }
+ public WPos TopLeft => Context.World.Map.ProjectedTopLeft;
+ // HACK: This api method abuses the coordinate system, and should be removed
+ // in favour of proper actor queries. See #8549.
[Desc("Returns the location of the bottom-right corner of the map (assuming zero terrain height).")]
- public WPos BottomRight
- {
- get
- {
- // HACK: This api method abuses the coordinate system, and should be removed
- // in favour of proper actor queries. See #8549.
- return Context.World.Map.ProjectedBottomRight;
- }
- }
+ public WPos BottomRight => Context.World.Map.ProjectedBottomRight;
[Desc("Returns a random cell inside the visible region of the map.")]
public CPos RandomCell()
@@ -109,10 +97,10 @@ namespace OpenRA.Mods.Common.Scripting
}
[Desc("Returns true if there is only one human player.")]
- public bool IsSinglePlayer { get { return Context.World.LobbyInfo.NonBotPlayers.Count() == 1; } }
+ public bool IsSinglePlayer => Context.World.LobbyInfo.NonBotPlayers.Count() == 1;
[Desc("Returns true if this is a shellmap and the player has paused animations.")]
- public bool IsPausedShellmap { get { return Context.World.Type == WorldType.Shellmap && gameSettings.PauseShellmap; } }
+ public bool IsPausedShellmap => Context.World.Type == WorldType.Shellmap && gameSettings.PauseShellmap;
[Desc("Returns the value of a `ScriptLobbyDropdown` selected in the game lobby.")]
public LuaValue LobbyOption(string id)
@@ -127,10 +115,10 @@ namespace OpenRA.Mods.Common.Scripting
}
[Desc("Returns a table of all the actors that were specified in the map file.")]
- public Actor[] NamedActors { get { return sma.Actors.Values.ToArray(); } }
+ public Actor[] NamedActors => sma.Actors.Values.ToArray();
[Desc("Returns the actor that was specified with a given name in " +
- "the map file (or nil, if the actor is dead or not found).")]
+ "the map file (or nil, if the actor is dead or not found).")]
public Actor NamedActor(string actorName)
{
if (!sma.Actors.TryGetValue(actorName, out var ret))
@@ -155,6 +143,6 @@ namespace OpenRA.Mods.Common.Scripting
}
[Desc("Returns a table of all the actors that are currently on the map/in the world.")]
- public Actor[] ActorsInWorld { get { return world.Actors.ToArray(); } }
+ public Actor[] ActorsInWorld => world.Actors.ToArray();
}
}
diff --git a/OpenRA.Mods.Common/Scripting/LuaScript.cs b/OpenRA.Mods.Common/Scripting/LuaScript.cs
index 3259448d73..c6ab301ca8 100644
--- a/OpenRA.Mods.Common/Scripting/LuaScript.cs
+++ b/OpenRA.Mods.Common/Scripting/LuaScript.cs
@@ -59,6 +59,6 @@ namespace OpenRA.Mods.Common.Scripting
disposed = true;
}
- public bool FatalErrorOccurred { get { return context.FatalErrorOccurred; } }
+ public bool FatalErrorOccurred => context.FatalErrorOccurred;
}
}
diff --git a/OpenRA.Mods.Common/Scripting/Properties/GainsExperienceProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/GainsExperienceProperties.cs
index d61750ace0..82db17eab8 100644
--- a/OpenRA.Mods.Common/Scripting/Properties/GainsExperienceProperties.cs
+++ b/OpenRA.Mods.Common/Scripting/Properties/GainsExperienceProperties.cs
@@ -27,16 +27,16 @@ namespace OpenRA.Mods.Common.Scripting
}
[Desc("The actor's amount of experience.")]
- public int Experience { get { return exp.Experience; } }
+ public int Experience => exp.Experience;
[Desc("The actor's level.")]
- public int Level { get { return exp.Level; } }
+ public int Level => exp.Level;
[Desc("The actor's maximum possible level.")]
- public int MaxLevel { get { return exp.MaxLevel; } }
+ public int MaxLevel => exp.MaxLevel;
[Desc("Returns true if the actor can gain a level.")]
- public bool CanGainLevel { get { return exp.CanGainLevel; } }
+ public bool CanGainLevel => exp.CanGainLevel;
[Desc("Gives the actor experience. If 'silent' is true, no animation or sound will be played if the actor levels up.")]
public void GiveExperience(int amount, bool silent = false)
diff --git a/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs
index a641b59c81..e9f304a0dc 100644
--- a/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs
+++ b/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs
@@ -31,10 +31,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Specifies whether the actor is in the world.")]
public bool IsInWorld
{
- get
- {
- return Self.IsInWorld;
- }
+ get => Self.IsInWorld;
set
{
@@ -46,18 +43,15 @@ namespace OpenRA.Mods.Common.Scripting
}
[Desc("Specifies whether the actor is alive or dead.")]
- public bool IsDead { get { return Self.IsDead; } }
+ public bool IsDead => Self.IsDead;
[Desc("Specifies whether the actor is idle (not performing any activities).")]
- public bool IsIdle { get { return Self.IsIdle; } }
+ public bool IsIdle => Self.IsIdle;
[Desc("The player that owns the actor.")]
public Player Owner
{
- get
- {
- return Self.Owner;
- }
+ get => Self.Owner;
set
{
@@ -70,7 +64,7 @@ namespace OpenRA.Mods.Common.Scripting
}
[Desc("The type of the actor (e.g. \"e1\").")]
- public string Type { get { return Self.Info.Name; } }
+ public string Type => Self.Info.Name;
[Desc("Test whether an actor has a specific property.")]
public bool HasProperty(string name)
@@ -116,10 +110,10 @@ namespace OpenRA.Mods.Common.Scripting
}
[Desc("The actor position in cell coordinates.")]
- public CPos Location { get { return Self.Location; } }
+ public CPos Location => Self.Location;
[Desc("The actor position in world coordinates.")]
- public WPos CenterPosition { get { return Self.CenterPosition; } }
+ public WPos CenterPosition => Self.CenterPosition;
[Desc("The direction that the actor is facing.")]
public WAngle Facing
@@ -170,10 +164,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Current actor stance. Returns nil if this actor doesn't support stances.")]
public string Stance
{
- get
- {
- return autotarget?.Stance.ToString();
- }
+ get => autotarget?.Stance.ToString();
set
{
@@ -200,7 +191,7 @@ namespace OpenRA.Mods.Common.Scripting
}
[Desc("Specifies whether or not the actor supports 'tags'.")]
- public bool IsTaggable { get { return scriptTags != null; } }
+ public bool IsTaggable => scriptTags != null;
[Desc("Add a tag to the actor. Returns true on success, false otherwise (for example the actor may already have the given tag).")]
public bool AddTag(string tag)
diff --git a/OpenRA.Mods.Common/Scripting/Properties/HealthProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/HealthProperties.cs
index bbe7eed672..2cc33310ab 100644
--- a/OpenRA.Mods.Common/Scripting/Properties/HealthProperties.cs
+++ b/OpenRA.Mods.Common/Scripting/Properties/HealthProperties.cs
@@ -29,12 +29,12 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Current health of the actor.")]
public int Health
{
- get { return health.HP; }
- set { health.InflictDamage(Self, Self, new Damage(health.HP - value), true); }
+ get => health.HP;
+ set => health.InflictDamage(Self, Self, new Damage(health.HP - value), true);
}
[Desc("Maximum health of the actor.")]
- public int MaxHealth { get { return health.MaxHP; } }
+ public int MaxHealth => health.MaxHP;
[Desc("Kill the actor. damageTypes may be omitted, specified as a string, or as table of strings.")]
public void Kill(object damageTypes = null)
diff --git a/OpenRA.Mods.Common/Scripting/Properties/MobileProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/MobileProperties.cs
index 6638ff8f32..39dac9bef4 100644
--- a/OpenRA.Mods.Common/Scripting/Properties/MobileProperties.cs
+++ b/OpenRA.Mods.Common/Scripting/Properties/MobileProperties.cs
@@ -67,6 +67,6 @@ namespace OpenRA.Mods.Common.Scripting
}
[Desc("Whether the actor can move (false if immobilized).")]
- public bool IsMobile { get { return !mobile.IsTraitDisabled && !mobile.IsTraitPaused; } }
+ public bool IsMobile => !mobile.IsTraitDisabled && !mobile.IsTraitPaused;
}
}
diff --git a/OpenRA.Mods.Common/Scripting/Properties/PlayerExperienceProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/PlayerExperienceProperties.cs
index 841830b113..b896dcbf81 100644
--- a/OpenRA.Mods.Common/Scripting/Properties/PlayerExperienceProperties.cs
+++ b/OpenRA.Mods.Common/Scripting/Properties/PlayerExperienceProperties.cs
@@ -28,15 +28,9 @@ namespace OpenRA.Mods.Common.Scripting
public int Experience
{
- get
- {
- return exp.Experience;
- }
+ get => exp.Experience;
- set
- {
- exp.GiveExperience(value - exp.Experience);
- }
+ set => exp.GiveExperience(value - exp.Experience);
}
}
}
diff --git a/OpenRA.Mods.Common/Scripting/Properties/PlayerProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/PlayerProperties.cs
index 58f516cecc..d5ca90537d 100644
--- a/OpenRA.Mods.Common/Scripting/Properties/PlayerProperties.cs
+++ b/OpenRA.Mods.Common/Scripting/Properties/PlayerProperties.cs
@@ -25,22 +25,22 @@ namespace OpenRA.Mods.Common.Scripting
: base(context, player) { }
[Desc("The player's internal name.")]
- public string InternalName { get { return Player.InternalName; } }
+ public string InternalName => Player.InternalName;
[Desc("The player's name.")]
- public string Name { get { return Player.PlayerName; } }
+ public string Name => Player.PlayerName;
[Desc("The player's color.")]
- public Color Color { get { return Player.Color; } }
+ public Color Color => Player.Color;
[Desc("The player's faction.")]
- public string Faction { get { return Player.Faction.InternalName; } }
+ public string Faction => Player.Faction.InternalName;
[Desc("The player's spawnpoint ID.")]
- public int Spawn { get { return Player.SpawnPoint; } }
+ public int Spawn => Player.SpawnPoint;
[Desc("The player's home/starting location.")]
- public CPos HomeLocation { get { return Player.HomeLocation; } }
+ public CPos HomeLocation => Player.HomeLocation;
[Desc("The player's team ID.")]
public int Team
@@ -63,13 +63,13 @@ namespace OpenRA.Mods.Common.Scripting
}
[Desc("Returns true if the player is a bot.")]
- public bool IsBot { get { return Player.IsBot; } }
+ public bool IsBot => Player.IsBot;
[Desc("Returns true if the player is non combatant.")]
- public bool IsNonCombatant { get { return Player.NonCombatant; } }
+ public bool IsNonCombatant => Player.NonCombatant;
[Desc("Returns true if the player is the local player.")]
- public bool IsLocalPlayer { get { return Player == (Player.World.RenderPlayer ?? Player.World.LocalPlayer); } }
+ public bool IsLocalPlayer => Player == (Player.World.RenderPlayer ?? Player.World.LocalPlayer);
[Desc("Returns all living actors staying inside the world for this player.")]
public Actor[] GetActors()
diff --git a/OpenRA.Mods.Common/Scripting/Properties/PlayerStatsProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/PlayerStatsProperties.cs
index 482a2f8739..d1cb20bfb8 100644
--- a/OpenRA.Mods.Common/Scripting/Properties/PlayerStatsProperties.cs
+++ b/OpenRA.Mods.Common/Scripting/Properties/PlayerStatsProperties.cs
@@ -27,21 +27,21 @@ namespace OpenRA.Mods.Common.Scripting
}
[Desc("The combined value of units killed by this player.")]
- public int KillsCost { get { return stats.KillsCost; } }
+ public int KillsCost => stats.KillsCost;
[Desc("The combined value of all units lost by this player.")]
- public int DeathsCost { get { return stats.DeathsCost; } }
+ public int DeathsCost => stats.DeathsCost;
[Desc("The total number of units killed by this player.")]
- public int UnitsKilled { get { return stats.UnitsKilled; } }
+ public int UnitsKilled => stats.UnitsKilled;
[Desc("The total number of units lost by this player.")]
- public int UnitsLost { get { return stats.UnitsDead; } }
+ public int UnitsLost => stats.UnitsDead;
[Desc("The total number of buildings killed by this player.")]
- public int BuildingsKilled { get { return stats.BuildingsKilled; } }
+ public int BuildingsKilled => stats.BuildingsKilled;
[Desc("The total number of buildings lost by this player.")]
- public int BuildingsLost { get { return stats.BuildingsDead; } }
+ public int BuildingsLost => stats.BuildingsDead;
}
}
diff --git a/OpenRA.Mods.Common/Scripting/Properties/PowerProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/PowerProperties.cs
index f5d483b3bd..099218e2cb 100644
--- a/OpenRA.Mods.Common/Scripting/Properties/PowerProperties.cs
+++ b/OpenRA.Mods.Common/Scripting/Properties/PowerProperties.cs
@@ -29,23 +29,14 @@ namespace OpenRA.Mods.Common.Scripting
}
[Desc("Returns the total of the power the player has.")]
- public int PowerProvided
- {
- get { return pm.PowerProvided; }
- }
+ public int PowerProvided => pm.PowerProvided;
[Desc("Returns the power used by the player.")]
- public int PowerDrained
- {
- get { return pm.PowerDrained; }
- }
+ public int PowerDrained => pm.PowerDrained;
[Desc("Returns the player's power state " +
- "(\"Normal\", \"Low\" or \"Critical\").")]
- public string PowerState
- {
- get { return pm.PowerState.ToString(); }
- }
+ "(\"Normal\", \"Low\" or \"Critical\").")]
+ public string PowerState => pm.PowerState.ToString();
[Desc("Triggers low power for the chosen amount of ticks.")]
public void TriggerPowerOutage(int ticks)
diff --git a/OpenRA.Mods.Common/Scripting/Properties/ProductionProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/ProductionProperties.cs
index 86652c6338..14a710fd29 100644
--- a/OpenRA.Mods.Common/Scripting/Properties/ProductionProperties.cs
+++ b/OpenRA.Mods.Common/Scripting/Properties/ProductionProperties.cs
@@ -92,10 +92,7 @@ namespace OpenRA.Mods.Common.Scripting
return Self.Location;
}
- set
- {
- rp.Path = new List { value };
- }
+ set => rp.Path = new List { value };
}
}
@@ -113,8 +110,8 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Query or set the factory's primary building status.")]
public bool IsPrimaryBuilding
{
- get { return pb.IsPrimary; }
- set { pb.SetPrimaryProducer(Self, value); }
+ get => pb.IsPrimary;
+ set => pb.SetPrimaryProducer(Self, value);
}
}
diff --git a/OpenRA.Mods.Common/Scripting/Properties/ResourceProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/ResourceProperties.cs
index 79b0f779f3..849e9c1243 100644
--- a/OpenRA.Mods.Common/Scripting/Properties/ResourceProperties.cs
+++ b/OpenRA.Mods.Common/Scripting/Properties/ResourceProperties.cs
@@ -30,18 +30,18 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("The amount of harvestable resources held by the player.")]
public int Resources
{
- get { return pr.Resources; }
- set { pr.Resources = value.Clamp(0, pr.ResourceCapacity); }
+ get => pr.Resources;
+ set => pr.Resources = value.Clamp(0, pr.ResourceCapacity);
}
[Desc("The maximum resource storage of the player.")]
- public int ResourceCapacity { get { return pr.ResourceCapacity; } }
+ public int ResourceCapacity => pr.ResourceCapacity;
[Desc("The amount of cash held by the player.")]
public int Cash
{
- get { return pr.Cash; }
- set { pr.Cash = Math.Max(0, value); }
+ get => pr.Cash;
+ set => pr.Cash = Math.Max(0, value);
}
}
}
diff --git a/OpenRA.Mods.Common/Scripting/Properties/TransportProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/TransportProperties.cs
index da8ddd2e71..9c23c2d583 100644
--- a/OpenRA.Mods.Common/Scripting/Properties/TransportProperties.cs
+++ b/OpenRA.Mods.Common/Scripting/Properties/TransportProperties.cs
@@ -30,13 +30,13 @@ namespace OpenRA.Mods.Common.Scripting
}
[Desc("Returns references to passengers inside the transport.")]
- public Actor[] Passengers { get { return cargo.Passengers.ToArray(); } }
+ public Actor[] Passengers => cargo.Passengers.ToArray();
[Desc("Specifies whether transport has any passengers.")]
- public bool HasPassengers { get { return cargo.Passengers.Any(); } }
+ public bool HasPassengers => cargo.Passengers.Any();
[Desc("Specifies the amount of passengers.")]
- public int PassengerCount { get { return cargo.Passengers.Count(); } }
+ public int PassengerCount => cargo.Passengers.Count();
[Desc("Teleport an existing actor inside this transport.")]
public void LoadPassenger(Actor a)
diff --git a/OpenRA.Mods.Common/ServerTraits/PlayerPinger.cs b/OpenRA.Mods.Common/ServerTraits/PlayerPinger.cs
index 4a49280d93..246bdfb0f5 100644
--- a/OpenRA.Mods.Common/ServerTraits/PlayerPinger.cs
+++ b/OpenRA.Mods.Common/ServerTraits/PlayerPinger.cs
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Server
static readonly int ConnTimeout = 60000; // Drop unresponsive clients after 60 seconds
// TickTimeout is in microseconds
- public int TickTimeout { get { return PingInterval * 100; } }
+ public int TickTimeout => PingInterval * 100;
long lastPing = 0;
long lastConnReport = 0;
diff --git a/OpenRA.Mods.Common/SpriteLoaders/DdsLoader.cs b/OpenRA.Mods.Common/SpriteLoaders/DdsLoader.cs
index 60e17383d6..b8320c6cbd 100644
--- a/OpenRA.Mods.Common/SpriteLoaders/DdsLoader.cs
+++ b/OpenRA.Mods.Common/SpriteLoaders/DdsLoader.cs
@@ -48,10 +48,10 @@ namespace OpenRA.Mods.Common.SpriteLoaders
{
public SpriteFrameType Type { get; private set; }
public Size Size { get; private set; }
- public Size FrameSize { get { return Size; } }
- public float2 Offset { get { return float2.Zero; } }
+ public Size FrameSize => Size;
+ public float2 Offset => float2.Zero;
public byte[] Data { get; private set; }
- public bool DisableExportPadding { get { return false; } }
+ public bool DisableExportPadding => false;
public DdsFrame(Stream stream)
{
diff --git a/OpenRA.Mods.Common/SpriteLoaders/PngSheetLoader.cs b/OpenRA.Mods.Common/SpriteLoaders/PngSheetLoader.cs
index cf1da27322..a333c88bd6 100644
--- a/OpenRA.Mods.Common/SpriteLoaders/PngSheetLoader.cs
+++ b/OpenRA.Mods.Common/SpriteLoaders/PngSheetLoader.cs
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.SpriteLoaders
public Size FrameSize { get; set; }
public float2 Offset { get; set; }
public byte[] Data { get; set; }
- public bool DisableExportPadding { get { return false; } }
+ public bool DisableExportPadding => false;
}
public bool TryParseSprite(Stream s, out ISpriteFrame[] frames, out TypeDictionary metadata)
diff --git a/OpenRA.Mods.Common/SpriteLoaders/ShpTSLoader.cs b/OpenRA.Mods.Common/SpriteLoaders/ShpTSLoader.cs
index 062a033826..b0ef64ce36 100644
--- a/OpenRA.Mods.Common/SpriteLoaders/ShpTSLoader.cs
+++ b/OpenRA.Mods.Common/SpriteLoaders/ShpTSLoader.cs
@@ -20,12 +20,12 @@ namespace OpenRA.Mods.Common.SpriteLoaders
{
class ShpTSFrame : ISpriteFrame
{
- public SpriteFrameType Type { get { return SpriteFrameType.Indexed8; } }
+ public SpriteFrameType Type => SpriteFrameType.Indexed8;
public Size Size { get; private set; }
public Size FrameSize { get; private set; }
public float2 Offset { get; private set; }
public byte[] Data { get; set; }
- public bool DisableExportPadding { get { return false; } }
+ public bool DisableExportPadding => false;
public readonly uint FileOffset;
public readonly byte Format;
diff --git a/OpenRA.Mods.Common/SpriteLoaders/TgaLoader.cs b/OpenRA.Mods.Common/SpriteLoaders/TgaLoader.cs
index 4fff9e3be2..098d0117b7 100644
--- a/OpenRA.Mods.Common/SpriteLoaders/TgaLoader.cs
+++ b/OpenRA.Mods.Common/SpriteLoaders/TgaLoader.cs
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.SpriteLoaders
public Size FrameSize { get; private set; }
public float2 Offset { get; private set; }
public byte[] Data { get; private set; }
- public bool DisableExportPadding { get { return false; } }
+ public bool DisableExportPadding => false;
public TgaFrame()
{
diff --git a/OpenRA.Mods.Common/Terrain/DefaultTerrain.cs b/OpenRA.Mods.Common/Terrain/DefaultTerrain.cs
index 3bb33061d0..f2e48d1ebd 100644
--- a/OpenRA.Mods.Common/Terrain/DefaultTerrain.cs
+++ b/OpenRA.Mods.Common/Terrain/DefaultTerrain.cs
@@ -118,10 +118,7 @@ namespace OpenRA.Mods.Common.Terrain
.Select(y => (TerrainTemplateInfo)new DefaultTerrainTemplateInfo(this, y)).ToDictionary(t => t.Id).AsReadOnly();
}
- public TerrainTypeInfo this[byte index]
- {
- get { return TerrainInfo[index]; }
- }
+ public TerrainTypeInfo this[byte index] => TerrainInfo[index];
public byte GetTerrainIndex(string type)
{
@@ -157,18 +154,18 @@ namespace OpenRA.Mods.Common.Terrain
return info != null;
}
- string ITerrainInfo.Id { get { return Id; } }
- TerrainTypeInfo[] ITerrainInfo.TerrainTypes { get { return TerrainInfo; } }
+ string ITerrainInfo.Id => Id;
+ TerrainTypeInfo[] ITerrainInfo.TerrainTypes => TerrainInfo;
TerrainTileInfo ITerrainInfo.GetTerrainInfo(TerrainTile r) { return GetTileInfo(r); }
bool ITerrainInfo.TryGetTerrainInfo(TerrainTile r, out TerrainTileInfo info) { return TryGetTileInfo(r, out info); }
- Color[] ITerrainInfo.HeightDebugColors { get { return HeightDebugColors; } }
+ Color[] ITerrainInfo.HeightDebugColors => HeightDebugColors;
IEnumerable ITerrainInfo.RestrictedPlayerColors { get { return TerrainInfo.Where(ti => ti.RestrictPlayerColor).Select(ti => ti.Color); } }
- float ITerrainInfo.MinHeightColorBrightness { get { return MinHeightColorBrightness; } }
- float ITerrainInfo.MaxHeightColorBrightness { get { return MaxHeightColorBrightness; } }
- TerrainTile ITerrainInfo.DefaultTerrainTile { get { return new TerrainTile(Templates.First().Key, 0); } }
+ float ITerrainInfo.MinHeightColorBrightness => MinHeightColorBrightness;
+ float ITerrainInfo.MaxHeightColorBrightness => MaxHeightColorBrightness;
+ TerrainTile ITerrainInfo.DefaultTerrainTile => new TerrainTile(Templates.First().Key, 0);
- string[] ITemplatedTerrainInfo.EditorTemplateOrder { get { return EditorTemplateOrder; } }
- IReadOnlyDictionary ITemplatedTerrainInfo.Templates { get { return Templates; } }
+ string[] ITemplatedTerrainInfo.EditorTemplateOrder => EditorTemplateOrder;
+ IReadOnlyDictionary ITemplatedTerrainInfo.Templates => Templates;
void ITerrainInfoNotifyMapCreated.MapCreated(Map map)
{
diff --git a/OpenRA.Mods.Common/Terrain/DefaultTileCache.cs b/OpenRA.Mods.Common/Terrain/DefaultTileCache.cs
index cd7bca7672..7317b13316 100644
--- a/OpenRA.Mods.Common/Terrain/DefaultTileCache.cs
+++ b/OpenRA.Mods.Common/Terrain/DefaultTileCache.cs
@@ -177,7 +177,7 @@ namespace OpenRA.Mods.Common.Terrain
return template.Sprites[start * template.Stride + r.Index];
}
- public Sprite MissingTile { get { return missingTile; } }
+ public Sprite MissingTile => missingTile;
public void Dispose()
{
diff --git a/OpenRA.Mods.Common/Terrain/TerrainInfo.cs b/OpenRA.Mods.Common/Terrain/TerrainInfo.cs
index d52909436c..539c650213 100644
--- a/OpenRA.Mods.Common/Terrain/TerrainInfo.cs
+++ b/OpenRA.Mods.Common/Terrain/TerrainInfo.cs
@@ -88,16 +88,13 @@ namespace OpenRA.Mods.Common.Terrain
return tile;
}
- public TerrainTileInfo this[int index] { get { return tileInfo[index]; } }
+ public TerrainTileInfo this[int index] => tileInfo[index];
public bool Contains(int index)
{
return index >= 0 && index < tileInfo.Length;
}
- public int TilesCount
- {
- get { return tileInfo.Length; }
- }
+ public int TilesCount => tileInfo.Length;
}
}
diff --git a/OpenRA.Mods.Common/Traits/ActorSpawner.cs b/OpenRA.Mods.Common/Traits/ActorSpawner.cs
index bc58ff73ff..bbe961742c 100644
--- a/OpenRA.Mods.Common/Traits/ActorSpawner.cs
+++ b/OpenRA.Mods.Common/Traits/ActorSpawner.cs
@@ -27,6 +27,6 @@ namespace OpenRA.Mods.Common.Traits
public ActorSpawner(ActorSpawnerInfo info)
: base(info) { }
- public HashSet Types { get { return Info.Types; } }
+ public HashSet Types => Info.Types;
}
}
diff --git a/OpenRA.Mods.Common/Traits/AffectsShroud.cs b/OpenRA.Mods.Common/Traits/AffectsShroud.cs
index cac3031af8..8a5920ed10 100644
--- a/OpenRA.Mods.Common/Traits/AffectsShroud.cs
+++ b/OpenRA.Mods.Common/Traits/AffectsShroud.cs
@@ -152,7 +152,7 @@ namespace OpenRA.Mods.Common.Traits
RemoveCellsFromPlayerShroud(self, p);
}
- public virtual WDist Range { get { return CachedTraitDisabled ? WDist.Zero : Info.Range; } }
+ public virtual WDist Range => CachedTraitDisabled ? WDist.Zero : Info.Range;
void INotifyMoving.MovementTypeChanged(Actor self, MovementType type)
{
diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs
index 30363c18fd..0dde0d3ea8 100644
--- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs
+++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs
@@ -179,7 +179,7 @@ namespace OpenRA.Mods.Common.Traits
public IReadOnlyDictionary OccupiedCells(ActorInfo info, CPos location, SubCell subCell = SubCell.Any) { return new ReadOnlyDictionary(); }
- bool IOccupySpaceInfo.SharesCell { get { return false; } }
+ bool IOccupySpaceInfo.SharesCell => false;
// Used to determine if an aircraft can spawn landed
public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
@@ -232,30 +232,30 @@ namespace OpenRA.Mods.Common.Traits
[Sync]
public WAngle Facing
{
- get { return orientation.Yaw; }
- set { orientation = orientation.WithYaw(value); }
+ get => orientation.Yaw;
+ set => orientation = orientation.WithYaw(value);
}
public WAngle Pitch
{
- get { return orientation.Pitch; }
- set { orientation = orientation.WithPitch(value); }
+ get => orientation.Pitch;
+ set => orientation = orientation.WithPitch(value);
}
public WAngle Roll
{
- get { return orientation.Roll; }
- set { orientation = orientation.WithRoll(value); }
+ get => orientation.Roll;
+ set => orientation = orientation.WithRoll(value);
}
- public WRot Orientation { get { return orientation; } }
+ public WRot Orientation => orientation;
[Sync]
public WPos CenterPosition { get; private set; }
- public CPos TopLeft { get { return self.World.Map.CellContaining(CenterPosition); } }
- public WAngle TurnSpeed { get { return !IsTraitDisabled && !IsTraitPaused ? Info.TurnSpeed : WAngle.Zero; } }
- public WAngle? IdleTurnSpeed { get { return Info.IdleTurnSpeed; } }
+ public CPos TopLeft => self.World.Map.CellContaining(CenterPosition);
+ public WAngle TurnSpeed => !IsTraitDisabled && !IsTraitPaused ? Info.TurnSpeed : WAngle.Zero;
+ public WAngle? IdleTurnSpeed => Info.IdleTurnSpeed;
public Actor ReservedActor { get; private set; }
public bool MayYieldReservation { get; private set; }
@@ -272,7 +272,7 @@ namespace OpenRA.Mods.Common.Traits
return self.CenterPosition - new WVec(WDist.Zero, WDist.Zero, self.World.Map.DistanceAboveTerrain(self.CenterPosition));
}
- public bool AtLandAltitude { get { return self.World.Map.DistanceAboveTerrain(GetPosition()) == LandAltitude; } }
+ public bool AtLandAltitude => self.World.Map.DistanceAboveTerrain(GetPosition()) == LandAltitude;
bool airborne;
bool cruising;
@@ -595,10 +595,7 @@ namespace OpenRA.Mods.Common.Traits
return allowedToEnterRearmer || allowedToEnterRepairer;
}
- public int MovementSpeed
- {
- get { return !IsTraitDisabled && !IsTraitPaused ? Util.ApplyPercentageModifiers(Info.Speed, speedModifiers) : 0; }
- }
+ public int MovementSpeed => !IsTraitDisabled && !IsTraitPaused ? Util.ApplyPercentageModifiers(Info.Speed, speedModifiers) : 0;
public (CPos Cell, SubCell SubCell)[] OccupiedCells()
{
@@ -967,10 +964,7 @@ namespace OpenRA.Mods.Common.Traits
public MovementType CurrentMovementTypes
{
- get
- {
- return movementTypes;
- }
+ get => movementTypes;
set
{
@@ -1247,7 +1241,7 @@ namespace OpenRA.Mods.Common.Traits
readonly Aircraft aircraft;
public string OrderID { get; protected set; }
- public int OrderPriority { get { return 4; } }
+ public int OrderPriority => 4;
public bool IsQueued { get; protected set; }
public AircraftMoveOrderTargeter(Aircraft aircraft)
diff --git a/OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs b/OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs
index d350f709d5..bad28a85da 100644
--- a/OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs
+++ b/OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs
@@ -60,8 +60,8 @@ namespace OpenRA.Mods.Common.Traits
}
// We return init.Self.Owner if there's no effective owner
- bool IEffectiveOwner.Disguised { get { return true; } }
- Player IEffectiveOwner.Owner { get { return effectiveOwner; } }
+ bool IEffectiveOwner.Disguised => true;
+ Player IEffectiveOwner.Owner => effectiveOwner;
void INotifyCreated.Created(Actor self)
{
diff --git a/OpenRA.Mods.Common/Traits/AmmoPool.cs b/OpenRA.Mods.Common/Traits/AmmoPool.cs
index f4925d0fed..a1a3a92016 100644
--- a/OpenRA.Mods.Common/Traits/AmmoPool.cs
+++ b/OpenRA.Mods.Common/Traits/AmmoPool.cs
@@ -59,8 +59,8 @@ namespace OpenRA.Mods.Common.Traits
[Sync]
public int CurrentAmmoCount { get; private set; }
- public bool HasAmmo { get { return CurrentAmmoCount > 0; } }
- public bool HasFullAmmo { get { return CurrentAmmoCount == Info.Ammo; } }
+ public bool HasAmmo => CurrentAmmoCount > 0;
+ public bool HasFullAmmo => CurrentAmmoCount == Info.Ammo;
public AmmoPool(Actor self, AmmoPoolInfo info)
{
diff --git a/OpenRA.Mods.Common/Traits/Armament.cs b/OpenRA.Mods.Common/Traits/Armament.cs
index 33912ecf39..1db4bedd01 100644
--- a/OpenRA.Mods.Common/Traits/Armament.cs
+++ b/OpenRA.Mods.Common/Traits/Armament.cs
@@ -363,7 +363,7 @@ namespace OpenRA.Mods.Common.Traits
}
}
- public virtual bool IsReloading { get { return FireDelay > 0 || IsTraitDisabled; } }
+ public virtual bool IsReloading => FireDelay > 0 || IsTraitDisabled;
public WVec MuzzleOffset(Actor self, Barrel b)
{
@@ -396,6 +396,6 @@ namespace OpenRA.Mods.Common.Traits
return WRot.FromYaw(b.Yaw).Rotate(turret != null ? turret.WorldOrientation : self.Orientation);
}
- public Actor Actor { get { return self; } }
+ public Actor Actor => self;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs
index 39b32f310e..2563fe4e5e 100644
--- a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs
+++ b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Traits
[Sync]
public bool IsAiming { get; set; }
- public IEnumerable Armaments { get { return getArmaments(); } }
+ public IEnumerable Armaments => getArmaments();
protected IFacing facing;
protected IPositionable positionable;
diff --git a/OpenRA.Mods.Common/Traits/AttackMove.cs b/OpenRA.Mods.Common/Traits/AttackMove.cs
index e6f699980c..36dacc6e75 100644
--- a/OpenRA.Mods.Common/Traits/AttackMove.cs
+++ b/OpenRA.Mods.Common/Traits/AttackMove.cs
@@ -155,6 +155,6 @@ namespace OpenRA.Mods.Common.Traits
return true;
}
- public override bool ClearSelectionOnLeftClick { get { return false; } }
+ public override bool ClearSelectionOnLeftClick => false;
}
}
diff --git a/OpenRA.Mods.Common/Traits/AutoCarryable.cs b/OpenRA.Mods.Common/Traits/AutoCarryable.cs
index 8a1d7b9397..c4ba66444f 100644
--- a/OpenRA.Mods.Common/Traits/AutoCarryable.cs
+++ b/OpenRA.Mods.Common/Traits/AutoCarryable.cs
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits
this.info = info;
}
- public WDist MinimumDistance { get { return info.MinDistance; } }
+ public WDist MinimumDistance => info.MinDistance;
// No longer want to be carried
void ICallForTransport.MovementCancelled(Actor self) { MovementCancelled(self); }
diff --git a/OpenRA.Mods.Common/Traits/AutoTarget.cs b/OpenRA.Mods.Common/Traits/AutoTarget.cs
index e0d922da4c..6fede19f07 100644
--- a/OpenRA.Mods.Common/Traits/AutoTarget.cs
+++ b/OpenRA.Mods.Common/Traits/AutoTarget.cs
@@ -135,7 +135,7 @@ namespace OpenRA.Mods.Common.Traits
[Sync]
int nextScanTime = 0;
- public UnitStance Stance { get { return stance; } }
+ public UnitStance Stance => stance;
[Sync]
public Actor Aggressor;
diff --git a/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs b/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs
index 647e3e5ca3..e26df2d928 100644
--- a/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs
+++ b/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
public BlocksProjectiles(Actor self, BlocksProjectilesInfo info)
: base(info) { }
- WDist IBlocksProjectiles.BlockingHeight { get { return Info.Height; } }
+ WDist IBlocksProjectiles.BlockingHeight => Info.Height;
public static bool AnyBlockingActorAt(World world, WPos pos)
{
diff --git a/OpenRA.Mods.Common/Traits/BodyOrientation.cs b/OpenRA.Mods.Common/Traits/BodyOrientation.cs
index 2a7071644b..edf74258cf 100644
--- a/OpenRA.Mods.Common/Traits/BodyOrientation.cs
+++ b/OpenRA.Mods.Common/Traits/BodyOrientation.cs
@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits
readonly Lazy quantizedFacings;
[Sync]
- public int QuantizedFacings { get { return quantizedFacings.Value; } }
+ public int QuantizedFacings => quantizedFacings.Value;
public BodyOrientation(ActorInitializer init, BodyOrientationInfo info)
{
@@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Traits
});
}
- public WAngle CameraPitch { get { return info.CameraPitch; } }
+ public WAngle CameraPitch => info.CameraPitch;
public WVec LocalToWorld(WVec vec)
{
diff --git a/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs
index 58afdeb2ca..f994069e39 100644
--- a/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs
+++ b/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs
@@ -144,7 +144,7 @@ namespace OpenRA.Mods.Common.Traits
return randomConstructionYard != null ? randomConstructionYard.Location : initialBaseCenter;
}
- public CPos DefenseCenter { get { return defenseCenter; } }
+ public CPos DefenseCenter => defenseCenter;
readonly World world;
readonly Player player;
@@ -194,10 +194,7 @@ namespace OpenRA.Mods.Common.Traits
defenseCenter = newLocation;
}
- bool IBotRequestPauseUnitProduction.PauseUnitProduction
- {
- get { return !IsTraitDisabled && !HasAdequateRefineryCount; }
- }
+ bool IBotRequestPauseUnitProduction.PauseUnitProduction => !IsTraitDisabled && !HasAdequateRefineryCount;
void IBotTick.BotTick(IBot bot)
{
@@ -261,25 +258,14 @@ namespace OpenRA.Mods.Common.Traits
return info != null && world.IsCellBuildable(x, null, info);
}
- public bool HasAdequateRefineryCount
- {
- get
- {
- // Require at least one refinery, unless we can't build it.
- return !Info.RefineryTypes.Any() ||
- AIUtils.CountBuildingByCommonName(Info.RefineryTypes, player) >= MinimumRefineryCount ||
- AIUtils.CountBuildingByCommonName(Info.PowerTypes, player) == 0 ||
- AIUtils.CountBuildingByCommonName(Info.ConstructionYardTypes, player) == 0;
- }
- }
+ // Require at least one refinery, unless we can't build it.
+ public bool HasAdequateRefineryCount =>
+ !Info.RefineryTypes.Any() ||
+ AIUtils.CountBuildingByCommonName(Info.RefineryTypes, player) >= MinimumRefineryCount ||
+ AIUtils.CountBuildingByCommonName(Info.PowerTypes, player) == 0 ||
+ AIUtils.CountBuildingByCommonName(Info.ConstructionYardTypes, player) == 0;
- int MinimumRefineryCount
- {
- get
- {
- return AIUtils.CountBuildingByCommonName(Info.BarracksTypes, player) > 0 ? Info.InititalMinimumRefineryCount + Info.AdditionalMinimumRefineryCount : Info.InititalMinimumRefineryCount;
- }
- }
+ int MinimumRefineryCount => AIUtils.CountBuildingByCommonName(Info.BarracksTypes, player) > 0 ? Info.InititalMinimumRefineryCount + Info.AdditionalMinimumRefineryCount : Info.InititalMinimumRefineryCount;
List IGameSaveTraitData.IssueTraitData(Actor self)
{
diff --git a/OpenRA.Mods.Common/Traits/BotModules/Squads/Squad.cs b/OpenRA.Mods.Common/Traits/BotModules/Squads/Squad.cs
index f65c41b669..21fd6bfc9b 100644
--- a/OpenRA.Mods.Common/Traits/BotModules/Squads/Squad.cs
+++ b/OpenRA.Mods.Common/Traits/BotModules/Squads/Squad.cs
@@ -68,23 +68,17 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
FuzzyStateMachine.Update(this);
}
- public bool IsValid { get { return Units.Any(); } }
+ public bool IsValid => Units.Any();
public Actor TargetActor
{
- get { return Target.Actor; }
- set { Target = Target.FromActor(value); }
+ get => Target.Actor;
+ set => Target = Target.FromActor(value);
}
- public bool IsTargetValid
- {
- get { return Target.IsValidFor(Units.FirstOrDefault()) && !Target.Actor.Info.HasTraitInfo(); }
- }
+ public bool IsTargetValid => Target.IsValidFor(Units.FirstOrDefault()) && !Target.Actor.Info.HasTraitInfo();
- public bool IsTargetVisible
- {
- get { return TargetActor.CanBeViewedByPlayer(Bot.Player); }
- }
+ public bool IsTargetVisible => TargetActor.CanBeViewedByPlayer(Bot.Player);
public WPos CenterPosition { get { return Units.Select(u => u.CenterPosition).Average(); } }
diff --git a/OpenRA.Mods.Common/Traits/Buildings/BaseProvider.cs b/OpenRA.Mods.Common/Traits/Buildings/BaseProvider.cs
index 81ddcdd276..cc2a512d2f 100644
--- a/OpenRA.Mods.Common/Traits/Buildings/BaseProvider.cs
+++ b/OpenRA.Mods.Common/Traits/Buildings/BaseProvider.cs
@@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Traits
return RangeCircleRenderables(wr);
}
- bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
+ bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
float ISelectionBar.GetValue()
{
@@ -130,6 +130,6 @@ namespace OpenRA.Mods.Common.Traits
}
Color ISelectionBar.GetColor() { return Color.Purple; }
- bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
+ bool ISelectionBar.DisplayWhenEmpty => false;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Buildings/Bridge.cs b/OpenRA.Mods.Common/Traits/Buildings/Bridge.cs
index 64caa81b2d..0196c3dbc9 100644
--- a/OpenRA.Mods.Common/Traits/Buildings/Bridge.cs
+++ b/OpenRA.Mods.Common/Traits/Buildings/Bridge.cs
@@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Traits
Dictionary footprint;
public LegacyBridgeHut Hut { get; private set; }
- public bool IsDangling { get { return isDangling.Value; } }
+ public bool IsDangling => isDangling.Value;
public Bridge(Actor self, BridgeInfo info)
{
diff --git a/OpenRA.Mods.Common/Traits/Buildings/BridgeHut.cs b/OpenRA.Mods.Common/Traits/Buildings/BridgeHut.cs
index 38aeba4aed..320c53ed51 100644
--- a/OpenRA.Mods.Common/Traits/Buildings/BridgeHut.cs
+++ b/OpenRA.Mods.Common/Traits/Buildings/BridgeHut.cs
@@ -236,6 +236,6 @@ namespace OpenRA.Mods.Common.Traits
}
}
- public bool Repairing { get { return repairStep < segmentLocations.Count; } }
+ public bool Repairing => repairStep < segmentLocations.Count;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Buildings/BridgePlaceholder.cs b/OpenRA.Mods.Common/Traits/Buildings/BridgePlaceholder.cs
index 8dbacf78f1..dea775768b 100644
--- a/OpenRA.Mods.Common/Traits/Buildings/BridgePlaceholder.cs
+++ b/OpenRA.Mods.Common/Traits/Buildings/BridgePlaceholder.cs
@@ -75,10 +75,10 @@ namespace OpenRA.Mods.Common.Traits
// Do nothing
}
- string IBridgeSegment.Type { get { return Info.Type; } }
- DamageState IBridgeSegment.DamageState { get { return Info.DamageState; } }
- bool IBridgeSegment.Valid { get { return self.IsInWorld; } }
- CVec[] IBridgeSegment.NeighbourOffsets { get { return Info.NeighbourOffsets; } }
- CPos IBridgeSegment.Location { get { return self.Location; } }
+ string IBridgeSegment.Type => Info.Type;
+ DamageState IBridgeSegment.DamageState => Info.DamageState;
+ bool IBridgeSegment.Valid => self.IsInWorld;
+ CVec[] IBridgeSegment.NeighbourOffsets => Info.NeighbourOffsets;
+ CPos IBridgeSegment.Location => self.Location;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Buildings/Building.cs b/OpenRA.Mods.Common/Traits/Buildings/Building.cs
index 5a371814f4..6c75f7d1f4 100644
--- a/OpenRA.Mods.Common/Traits/Buildings/Building.cs
+++ b/OpenRA.Mods.Common/Traits/Buildings/Building.cs
@@ -244,7 +244,7 @@ namespace OpenRA.Mods.Common.Traits
return new ReadOnlyDictionary(occupied);
}
- bool IOccupySpaceInfo.SharesCell { get { return false; } }
+ bool IOccupySpaceInfo.SharesCell => false;
public IEnumerable RenderAnnotations(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
{
@@ -270,7 +270,7 @@ namespace OpenRA.Mods.Common.Traits
(CPos, SubCell)[] targetableCells;
CPos[] transitOnlyCells;
- public CPos TopLeft { get { return topLeft; } }
+ public CPos TopLeft => topLeft;
public WPos CenterPosition { get; private set; }
public Building(ActorInitializer init, BuildingInfo info)
diff --git a/OpenRA.Mods.Common/Traits/Buildings/FootprintPlaceBuildingPreview.cs b/OpenRA.Mods.Common/Traits/Buildings/FootprintPlaceBuildingPreview.cs
index 2abff29f85..2433d2b7a7 100644
--- a/OpenRA.Mods.Common/Traits/Buildings/FootprintPlaceBuildingPreview.cs
+++ b/OpenRA.Mods.Common/Traits/Buildings/FootprintPlaceBuildingPreview.cs
@@ -129,6 +129,6 @@ namespace OpenRA.Mods.Common.Traits
void IPlaceBuildingPreview.Tick() { TickInner(); }
- int2 IPlaceBuildingPreview.TopLeftScreenOffset { get { return topLeftScreenOffset; } }
+ int2 IPlaceBuildingPreview.TopLeftScreenOffset => topLeftScreenOffset;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Buildings/Gate.cs b/OpenRA.Mods.Common/Traits/Buildings/Gate.cs
index f2bd8a7f66..8b02a5d0b5 100644
--- a/OpenRA.Mods.Common/Traits/Buildings/Gate.cs
+++ b/OpenRA.Mods.Common/Traits/Buildings/Gate.cs
@@ -136,12 +136,6 @@ namespace OpenRA.Mods.Common.Traits
return blockedPositions.Any(loc => self.World.ActorMap.GetActorsAt(loc).Any(a => a != self));
}
- WDist IBlocksProjectiles.BlockingHeight
- {
- get
- {
- return new WDist(Info.BlocksProjectilesHeight.Length * (OpenPosition - Position) / OpenPosition);
- }
- }
+ WDist IBlocksProjectiles.BlockingHeight => new WDist(Info.BlocksProjectilesHeight.Length * (OpenPosition - Position) / OpenPosition);
}
}
diff --git a/OpenRA.Mods.Common/Traits/Buildings/GivesBuildableArea.cs b/OpenRA.Mods.Common/Traits/Buildings/GivesBuildableArea.cs
index 38a31c6e5b..3be328f1f1 100644
--- a/OpenRA.Mods.Common/Traits/Buildings/GivesBuildableArea.cs
+++ b/OpenRA.Mods.Common/Traits/Buildings/GivesBuildableArea.cs
@@ -30,6 +30,6 @@ namespace OpenRA.Mods.Common.Traits
readonly HashSet noAreaTypes = new HashSet();
- public HashSet AreaTypes { get { return !IsTraitDisabled ? Info.AreaTypes : noAreaTypes; } }
+ public HashSet AreaTypes => !IsTraitDisabled ? Info.AreaTypes : noAreaTypes;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Buildings/GroundLevelBridge.cs b/OpenRA.Mods.Common/Traits/Buildings/GroundLevelBridge.cs
index ee21b15210..d6b5c584e2 100644
--- a/OpenRA.Mods.Common/Traits/Buildings/GroundLevelBridge.cs
+++ b/OpenRA.Mods.Common/Traits/Buildings/GroundLevelBridge.cs
@@ -117,10 +117,10 @@ namespace OpenRA.Mods.Common.Traits
});
}
- string IBridgeSegment.Type { get { return Info.Type; } }
- DamageState IBridgeSegment.DamageState { get { return self.GetDamageState(); } }
- bool IBridgeSegment.Valid { get { return self.IsInWorld; } }
- CVec[] IBridgeSegment.NeighbourOffsets { get { return Info.NeighbourOffsets; } }
- CPos IBridgeSegment.Location { get { return self.Location; } }
+ string IBridgeSegment.Type => Info.Type;
+ DamageState IBridgeSegment.DamageState => self.GetDamageState();
+ bool IBridgeSegment.Valid => self.IsInWorld;
+ CVec[] IBridgeSegment.NeighbourOffsets => Info.NeighbourOffsets;
+ CPos IBridgeSegment.Location => self.Location;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Buildings/LegacyBridgeHut.cs b/OpenRA.Mods.Common/Traits/Buildings/LegacyBridgeHut.cs
index c2eecb3b74..91d41dcb6a 100644
--- a/OpenRA.Mods.Common/Traits/Buildings/LegacyBridgeHut.cs
+++ b/OpenRA.Mods.Common/Traits/Buildings/LegacyBridgeHut.cs
@@ -28,8 +28,8 @@ namespace OpenRA.Mods.Common.Traits
{
public Bridge FirstBridge { get; private set; }
public Bridge Bridge { get; private set; }
- public DamageState BridgeDamageState { get { return Bridge.AggregateDamageState(); } }
- public bool Repairing { get { return repairDirections > 0; } }
+ public DamageState BridgeDamageState => Bridge.AggregateDamageState();
+ public bool Repairing => repairDirections > 0;
int repairDirections = 0;
public LegacyBridgeHut(ActorInitializer init, LegacyBridgeHutInfo info)
diff --git a/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs b/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs
index d0acfedb9d..fb56ca55a3 100644
--- a/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs
+++ b/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs
@@ -132,8 +132,8 @@ namespace OpenRA.Mods.Common.Traits
this.cursor = cursor;
}
- public string OrderID { get { return "SetRallyPoint"; } }
- public int OrderPriority { get { return 0; } }
+ public string OrderID => "SetRallyPoint";
+ public int OrderPriority => 0;
public bool TargetOverridesSelection(Actor self, in Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
public bool ForceSet { get; private set; }
public bool IsQueued { get; protected set; }
diff --git a/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs b/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs
index 3300f13c15..4e119a474b 100644
--- a/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs
+++ b/OpenRA.Mods.Common/Traits/Buildings/Refinery.cs
@@ -69,12 +69,12 @@ namespace OpenRA.Mods.Common.Traits
[Sync]
bool preventDock = false;
- public bool AllowDocking { get { return !preventDock; } }
- public CVec DeliveryOffset { get { return info.DockOffset; } }
- public WAngle DeliveryAngle { get { return info.DockAngle; } }
- public bool IsDragRequired { get { return info.IsDragRequired; } }
- public WVec DragOffset { get { return info.DragOffset; } }
- public int DragLength { get { return info.DragLength; } }
+ public bool AllowDocking => !preventDock;
+ public CVec DeliveryOffset => info.DockOffset;
+ public WAngle DeliveryAngle => info.DockAngle;
+ public bool IsDragRequired => info.IsDragRequired;
+ public WVec DragOffset => info.DragOffset;
+ public int DragLength => info.DragLength;
public Refinery(Actor self, RefineryInfo info)
{
diff --git a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs
index 641887ab5d..355b099b6d 100644
--- a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs
+++ b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs
@@ -186,8 +186,8 @@ namespace OpenRA.Mods.Common.Traits
this.aircraft = aircraft;
}
- public string OrderID { get { return "Move"; } }
- public int OrderPriority { get { return 4; } }
+ public string OrderID => "Move";
+ public int OrderPriority => 4;
public bool IsQueued { get; protected set; }
public bool CanTarget(Actor self, in Target target, List othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
diff --git a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs
index 9633a06af3..caba137db0 100644
--- a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs
+++ b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs
@@ -177,8 +177,8 @@ namespace OpenRA.Mods.Common.Traits
rejectMove = !self.AcceptsOrder("Move");
}
- public string OrderID { get { return "Move"; } }
- public int OrderPriority { get { return 4; } }
+ public string OrderID => "Move";
+ public int OrderPriority => 4;
public bool IsQueued { get; protected set; }
public bool CanTarget(Actor self, in Target target, List othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
diff --git a/OpenRA.Mods.Common/Traits/CapturableProgressBar.cs b/OpenRA.Mods.Common/Traits/CapturableProgressBar.cs
index f2a4ef2c6f..7ca73af128 100644
--- a/OpenRA.Mods.Common/Traits/CapturableProgressBar.cs
+++ b/OpenRA.Mods.Common/Traits/CapturableProgressBar.cs
@@ -51,6 +51,6 @@ namespace OpenRA.Mods.Common.Traits
}
Color ISelectionBar.GetColor() { return Info.Color; }
- bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
+ bool ISelectionBar.DisplayWhenEmpty => false;
}
}
diff --git a/OpenRA.Mods.Common/Traits/CaptureProgressBar.cs b/OpenRA.Mods.Common/Traits/CaptureProgressBar.cs
index a013f1dd9b..af0366a51b 100644
--- a/OpenRA.Mods.Common/Traits/CaptureProgressBar.cs
+++ b/OpenRA.Mods.Common/Traits/CaptureProgressBar.cs
@@ -48,6 +48,6 @@ namespace OpenRA.Mods.Common.Traits
}
Color ISelectionBar.GetColor() { return Info.Color; }
- bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
+ bool ISelectionBar.DisplayWhenEmpty => false;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Cargo.cs b/OpenRA.Mods.Common/Traits/Cargo.cs
index ae0734b311..cd01c1a921 100644
--- a/OpenRA.Mods.Common/Traits/Cargo.cs
+++ b/OpenRA.Mods.Common/Traits/Cargo.cs
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly Dictionary PassengerConditions = new Dictionary();
[GrantedConditionReference]
- public IEnumerable LinterPassengerConditions { get { return PassengerConditions.Values; } }
+ public IEnumerable LinterPassengerConditions => PassengerConditions.Values;
public override object Create(ActorInitializer init) { return new Cargo(init, this); }
}
@@ -108,13 +108,10 @@ namespace OpenRA.Mods.Common.Traits
readonly CachedTransform> currentAdjacentCells;
- public IEnumerable CurrentAdjacentCells
- {
- get { return currentAdjacentCells.Update(self.Location); }
- }
+ public IEnumerable CurrentAdjacentCells => currentAdjacentCells.Update(self.Location);
- public IEnumerable Passengers { get { return cargo; } }
- public int PassengerCount { get { return cargo.Count; } }
+ public IEnumerable Passengers => cargo;
+ public int PassengerCount => cargo.Count;
enum State { Free, Locked }
State state = State.Free;
diff --git a/OpenRA.Mods.Common/Traits/Carryable.cs b/OpenRA.Mods.Common/Traits/Carryable.cs
index c1181390e5..552bc280ea 100644
--- a/OpenRA.Mods.Common/Traits/Carryable.cs
+++ b/OpenRA.Mods.Common/Traits/Carryable.cs
@@ -52,9 +52,9 @@ namespace OpenRA.Mods.Common.Traits
IDelayCarryallPickup[] delayPickups;
public Actor Carrier { get; private set; }
- public bool Reserved { get { return state != State.Free; } }
+ public bool Reserved => state != State.Free;
public CPos? Destination { get; protected set; }
- public bool WantsTransport { get { return Destination != null && !IsTraitDisabled; } }
+ public bool WantsTransport => Destination != null && !IsTraitDisabled;
protected enum State { Free, Reserved, Locked }
protected State state = State.Free;
diff --git a/OpenRA.Mods.Common/Traits/Carryall.cs b/OpenRA.Mods.Common/Traits/Carryall.cs
index 2302de181a..fb14c1d4ad 100644
--- a/OpenRA.Mods.Common/Traits/Carryall.cs
+++ b/OpenRA.Mods.Common/Traits/Carryall.cs
@@ -191,7 +191,7 @@ namespace OpenRA.Mods.Common.Traits
}
}
- HashSet IOverrideAircraftLanding.LandableTerrainTypes { get { return landableTerrainTypes ?? aircraft.Info.LandableTerrainTypes; } }
+ HashSet IOverrideAircraftLanding.LandableTerrainTypes => landableTerrainTypes ?? aircraft.Info.LandableTerrainTypes;
public virtual bool AttachCarryable(Actor self, Actor carryable)
{
@@ -399,8 +399,8 @@ namespace OpenRA.Mods.Common.Traits
readonly AircraftInfo aircraftInfo;
readonly CarryallInfo info;
- public string OrderID { get { return "DeliverUnit"; } }
- public int OrderPriority { get { return 6; } }
+ public string OrderID => "DeliverUnit";
+ public int OrderPriority => 6;
public bool IsQueued { get; protected set; }
public bool TargetOverridesSelection(Actor self, in Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
diff --git a/OpenRA.Mods.Common/Traits/Cloak.cs b/OpenRA.Mods.Common/Traits/Cloak.cs
index 5b41024b9f..310dec35bd 100644
--- a/OpenRA.Mods.Common/Traits/Cloak.cs
+++ b/OpenRA.Mods.Common/Traits/Cloak.cs
@@ -102,7 +102,7 @@ namespace OpenRA.Mods.Common.Traits
base.Created(self);
}
- public bool Cloaked { get { return !IsTraitDisabled && !IsTraitPaused && remainingTime <= 0; } }
+ public bool Cloaked => !IsTraitDisabled && !IsTraitPaused && remainingTime <= 0;
public void Uncloak() { Uncloak(Info.CloakDelay); }
diff --git a/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs b/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs
index 213683e62f..94b2197e42 100644
--- a/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs
+++ b/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Traits
yield return r;
}
- bool IRenderAnnotations.SpatiallyPartitionable { get { return true; } }
+ bool IRenderAnnotations.SpatiallyPartitionable => true;
IEnumerable RenderArmaments(Actor self, AttackBase attack)
{
diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs
index 93f5288610..2e68bddf20 100644
--- a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs
+++ b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs
@@ -100,7 +100,7 @@ namespace OpenRA.Mods.Common.Traits
int deployedToken = Actor.InvalidConditionToken;
int undeployedToken = Actor.InvalidConditionToken;
- public DeployState DeployState { get { return deployState; } }
+ public DeployState DeployState => deployState;
public GrantConditionOnDeploy(ActorInitializer init, GrantConditionOnDeployInfo info)
: base(info)
diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnProduction.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnProduction.cs
index c45e082d97..cb6fcd2d91 100644
--- a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnProduction.cs
+++ b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnProduction.cs
@@ -79,6 +79,6 @@ namespace OpenRA.Mods.Common.Traits
}
Color ISelectionBar.GetColor() { return info.SelectionBarColor; }
- bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
+ bool ISelectionBar.DisplayWhenEmpty => false;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Crates/Crate.cs b/OpenRA.Mods.Common/Traits/Crates/Crate.cs
index 4691f771ca..97984ea043 100644
--- a/OpenRA.Mods.Common/Traits/Crates/Crate.cs
+++ b/OpenRA.Mods.Common/Traits/Crates/Crate.cs
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
return new ReadOnlyDictionary(occupied);
}
- bool IOccupySpaceInfo.SharesCell { get { return false; } }
+ bool IOccupySpaceInfo.SharesCell => false;
public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
{
@@ -176,7 +176,7 @@ namespace OpenRA.Mods.Common.Traits
self.Dispose();
}
- public CPos TopLeft { get { return Location; } }
+ public CPos TopLeft => Location;
public (CPos, SubCell)[] OccupiedCells() { return new[] { (Location, SubCell.FullCell) }; }
public WPos CenterPosition { get; private set; }
diff --git a/OpenRA.Mods.Common/Traits/ExitsDebugOverlay.cs b/OpenRA.Mods.Common/Traits/ExitsDebugOverlay.cs
index b8e76f49ee..ef03985d10 100644
--- a/OpenRA.Mods.Common/Traits/ExitsDebugOverlay.cs
+++ b/OpenRA.Mods.Common/Traits/ExitsDebugOverlay.cs
@@ -101,6 +101,6 @@ namespace OpenRA.Mods.Common.Traits
}
}
- bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return true; } }
+ bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => true;
}
}
diff --git a/OpenRA.Mods.Common/Traits/GainsExperience.cs b/OpenRA.Mods.Common/Traits/GainsExperience.cs
index 966bfac323..dcbc8ff058 100644
--- a/OpenRA.Mods.Common/Traits/GainsExperience.cs
+++ b/OpenRA.Mods.Common/Traits/GainsExperience.cs
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly Dictionary Conditions = null;
[GrantedConditionReference]
- public IEnumerable LinterConditions { get { return Conditions.Values; } }
+ public IEnumerable LinterConditions => Conditions.Values;
[Desc("Image for the level up sprite.")]
public readonly string LevelUpImage = null;
@@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.Traits
GiveExperience(initialExperience, info.SuppressLevelupAnimation);
}
- public bool CanGainLevel { get { return Level < MaxLevel; } }
+ public bool CanGainLevel => Level < MaxLevel;
public void GiveLevels(int numLevels, bool silent = false)
{
diff --git a/OpenRA.Mods.Common/Traits/Harvester.cs b/OpenRA.Mods.Common/Traits/Harvester.cs
index 44b1bc7576..24e28d7006 100644
--- a/OpenRA.Mods.Common/Traits/Harvester.cs
+++ b/OpenRA.Mods.Common/Traits/Harvester.cs
@@ -214,9 +214,9 @@ namespace OpenRA.Mods.Common.Traits
return null;
}
- public bool IsFull { get { return contents.Values.Sum() == Info.Capacity; } }
- public bool IsEmpty { get { return contents.Values.Sum() == 0; } }
- public int Fullness { get { return contents.Values.Sum() * 100 / Info.Capacity; } }
+ public bool IsFull => contents.Values.Sum() == Info.Capacity;
+ public bool IsEmpty => contents.Values.Sum() == 0;
+ public int Fullness => contents.Values.Sum() * 100 / Info.Capacity;
void UpdateCondition(Actor self)
{
@@ -366,8 +366,8 @@ namespace OpenRA.Mods.Common.Traits
class HarvestOrderTargeter : IOrderTargeter
{
- public string OrderID { get { return "Harvest"; } }
- public int OrderPriority { get { return 10; } }
+ public string OrderID => "Harvest";
+ public int OrderPriority => 10;
public bool IsQueued { get; protected set; }
public bool TargetOverridesSelection(Actor self, in Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
diff --git a/OpenRA.Mods.Common/Traits/Health.cs b/OpenRA.Mods.Common/Traits/Health.cs
index ba402b5b68..ff4d8f505e 100644
--- a/OpenRA.Mods.Common/Traits/Health.cs
+++ b/OpenRA.Mods.Common/Traits/Health.cs
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits
throw new YamlException("Actors with Health need at least one HitShape trait!");
}
- int IHealthInfo.MaxHP { get { return HP; } }
+ int IHealthInfo.MaxHP => HP;
IEnumerable IEditorActorOptions.ActorOptions(ActorInfo ai, World world)
{
@@ -78,10 +78,10 @@ namespace OpenRA.Mods.Common.Traits
DisplayHP = hp;
}
- public int HP { get { return hp; } }
+ public int HP => hp;
public int MaxHP { get; private set; }
- public bool IsDead { get { return hp <= 0; } }
+ public bool IsDead => hp <= 0;
public bool RemoveOnDeath = true;
public DamageState DamageState
diff --git a/OpenRA.Mods.Common/Traits/HitShape.cs b/OpenRA.Mods.Common/Traits/HitShape.cs
index f590d3c819..b756bacc2d 100644
--- a/OpenRA.Mods.Common/Traits/HitShape.cs
+++ b/OpenRA.Mods.Common/Traits/HitShape.cs
@@ -85,7 +85,7 @@ namespace OpenRA.Mods.Common.Traits
base.Created(self);
}
- bool ITargetablePositions.AlwaysEnabled { get { return Info.RequiresCondition == null; } }
+ bool ITargetablePositions.AlwaysEnabled => Info.RequiresCondition == null;
IEnumerable ITargetablePositions.TargetablePositions(Actor self)
{
diff --git a/OpenRA.Mods.Common/Traits/Husk.cs b/OpenRA.Mods.Common/Traits/Husk.cs
index 60b6ae69e7..4f2e0dda86 100644
--- a/OpenRA.Mods.Common/Traits/Husk.cs
+++ b/OpenRA.Mods.Common/Traits/Husk.cs
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits
return new ReadOnlyDictionary(occupied);
}
- bool IOccupySpaceInfo.SharesCell { get { return false; } }
+ bool IOccupySpaceInfo.SharesCell => false;
public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
{
@@ -73,13 +73,13 @@ namespace OpenRA.Mods.Common.Traits
[Sync]
public WAngle Facing
{
- get { return orientation.Yaw; }
- set { orientation = orientation.WithYaw(value); }
+ get => orientation.Yaw;
+ set => orientation = orientation.WithYaw(value);
}
- public WRot Orientation { get { return orientation; } }
+ public WRot Orientation => orientation;
- public WAngle TurnSpeed { get { return WAngle.Zero; } }
+ public WAngle TurnSpeed => WAngle.Zero;
public Husk(ActorInitializer init, HuskInfo info)
{
@@ -175,8 +175,8 @@ namespace OpenRA.Mods.Common.Traits
}
// We return self.Owner if there's no effective owner
- bool IEffectiveOwner.Disguised { get { return true; } }
- Player IEffectiveOwner.Owner { get { return effectiveOwner; } }
+ bool IEffectiveOwner.Disguised => true;
+ Player IEffectiveOwner.Owner => effectiveOwner;
}
public class HuskSpeedInit : ValueActorInit, ISingleInstanceInit
diff --git a/OpenRA.Mods.Common/Traits/Immobile.cs b/OpenRA.Mods.Common/Traits/Immobile.cs
index 1d9692c984..e30f43123a 100644
--- a/OpenRA.Mods.Common/Traits/Immobile.cs
+++ b/OpenRA.Mods.Common/Traits/Immobile.cs
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
return new ReadOnlyDictionary(occupied);
}
- bool IOccupySpaceInfo.SharesCell { get { return false; } }
+ bool IOccupySpaceInfo.SharesCell => false;
}
class Immobile : IOccupySpace, ISync, INotifyAddedToWorld, INotifyRemovedFromWorld
@@ -52,8 +52,8 @@ namespace OpenRA.Mods.Common.Traits
occupied = new (CPos, SubCell)[0];
}
- public CPos TopLeft { get { return location; } }
- public WPos CenterPosition { get { return position; } }
+ public CPos TopLeft => location;
+ public WPos CenterPosition => position;
public (CPos, SubCell)[] OccupiedCells() { return occupied; }
void INotifyAddedToWorld.AddedToWorld(Actor self)
diff --git a/OpenRA.Mods.Common/Traits/Infantry/ScaredyCat.cs b/OpenRA.Mods.Common/Traits/Infantry/ScaredyCat.cs
index 0f00e48af4..b8171c7721 100644
--- a/OpenRA.Mods.Common/Traits/Infantry/ScaredyCat.cs
+++ b/OpenRA.Mods.Common/Traits/Infantry/ScaredyCat.cs
@@ -48,10 +48,10 @@ namespace OpenRA.Mods.Common.Traits
[Sync]
int panicStartedTick;
- bool Panicking { get { return panicStartedTick > 0; } }
+ bool Panicking => panicStartedTick > 0;
- bool IRenderInfantrySequenceModifier.IsModifyingSequence { get { return Panicking; } }
- string IRenderInfantrySequenceModifier.SequencePrefix { get { return info.PanicSequencePrefix; } }
+ bool IRenderInfantrySequenceModifier.IsModifyingSequence => Panicking;
+ string IRenderInfantrySequenceModifier.SequencePrefix => info.PanicSequencePrefix;
public ScaredyCat(Actor self, ScaredyCatInfo info)
{
diff --git a/OpenRA.Mods.Common/Traits/Infantry/TakeCover.cs b/OpenRA.Mods.Common/Traits/Infantry/TakeCover.cs
index de47497494..e86ea52d70 100644
--- a/OpenRA.Mods.Common/Traits/Infantry/TakeCover.cs
+++ b/OpenRA.Mods.Common/Traits/Infantry/TakeCover.cs
@@ -58,10 +58,10 @@ namespace OpenRA.Mods.Common.Traits
[Sync]
int remainingDuration = 0;
- bool IsProne { get { return !IsTraitDisabled && remainingDuration != 0; } }
+ bool IsProne => !IsTraitDisabled && remainingDuration != 0;
- bool IRenderInfantrySequenceModifier.IsModifyingSequence { get { return IsProne; } }
- string IRenderInfantrySequenceModifier.SequencePrefix { get { return info.ProneSequencePrefix; } }
+ bool IRenderInfantrySequenceModifier.IsModifyingSequence => IsProne;
+ string IRenderInfantrySequenceModifier.SequencePrefix => info.ProneSequencePrefix;
public TakeCover(ActorInitializer init, TakeCoverInfo info)
: base(init, info)
@@ -96,10 +96,7 @@ namespace OpenRA.Mods.Common.Traits
localOffset = WVec.Zero;
}
- public override bool HasAchievedDesiredFacing
- {
- get { return true; }
- }
+ public override bool HasAchievedDesiredFacing => true;
int IDamageModifier.GetDamageModifier(Actor attacker, Damage damage)
{
diff --git a/OpenRA.Mods.Common/Traits/IsometricSelectable.cs b/OpenRA.Mods.Common/Traits/IsometricSelectable.cs
index 3834cb7faf..cbc6681739 100644
--- a/OpenRA.Mods.Common/Traits/IsometricSelectable.cs
+++ b/OpenRA.Mods.Common/Traits/IsometricSelectable.cs
@@ -54,9 +54,9 @@ namespace OpenRA.Mods.Common.Traits
public override object Create(ActorInitializer init) { return new IsometricSelectable(init.Self, this); }
- int ISelectableInfo.Priority { get { return Priority; } }
- SelectionPriorityModifiers ISelectableInfo.PriorityModifiers { get { return PriorityModifiers; } }
- string ISelectableInfo.Voice { get { return Voice; } }
+ int ISelectableInfo.Priority => Priority;
+ SelectionPriorityModifiers ISelectableInfo.PriorityModifiers => PriorityModifiers;
+ string ISelectableInfo.Voice => Voice;
public virtual void RulesetLoaded(Ruleset rules, ActorInfo ai)
{
@@ -136,6 +136,6 @@ namespace OpenRA.Mods.Common.Traits
return Bounds(self, wr);
}
- string ISelectable.Class { get { return selectionClass; } }
+ string ISelectable.Class => selectionClass;
}
}
diff --git a/OpenRA.Mods.Common/Traits/JamsMissiles.cs b/OpenRA.Mods.Common/Traits/JamsMissiles.cs
index 01ed19f138..d0a61ab555 100644
--- a/OpenRA.Mods.Common/Traits/JamsMissiles.cs
+++ b/OpenRA.Mods.Common/Traits/JamsMissiles.cs
@@ -30,9 +30,9 @@ namespace OpenRA.Mods.Common.Traits
public class JamsMissiles : ConditionalTrait
{
- public WDist Range { get { return IsTraitDisabled ? WDist.Zero : Info.Range; } }
- public PlayerRelationship DeflectionStances { get { return Info.DeflectionRelationships; } }
- public int Chance { get { return Info.Chance; } }
+ public WDist Range => IsTraitDisabled ? WDist.Zero : Info.Range;
+ public PlayerRelationship DeflectionStances => Info.DeflectionRelationships;
+ public int Chance => Info.Chance;
public JamsMissiles(JamsMissilesInfo info)
: base(info) { }
diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs
index b40428128b..a50af6b4b3 100644
--- a/OpenRA.Mods.Common/Traits/Mobile.cs
+++ b/OpenRA.Mods.Common/Traits/Mobile.cs
@@ -131,7 +131,7 @@ namespace OpenRA.Mods.Common.Traits
return new ReadOnlyDictionary(new Dictionary() { { location, subCell } });
}
- bool IOccupySpaceInfo.SharesCell { get { return LocomotorInfo.SharesCell; } }
+ bool IOccupySpaceInfo.SharesCell => LocomotorInfo.SharesCell;
IEnumerable IEditorActorOptions.ActorOptions(ActorInfo ai, World world)
{
@@ -159,10 +159,7 @@ namespace OpenRA.Mods.Common.Traits
MovementType movementTypes;
public MovementType CurrentMovementTypes
{
- get
- {
- return movementTypes;
- }
+ get => movementTypes;
set
{
@@ -195,30 +192,28 @@ namespace OpenRA.Mods.Common.Traits
public bool TurnToMove;
public bool IsBlocking { get; private set; }
- public bool IsMovingBetweenCells
- {
- get { return FromCell != ToCell; }
- }
+ public bool IsMovingBetweenCells => FromCell != ToCell;
#region IFacing
[Sync]
public WAngle Facing
{
- get { return orientation.Yaw; }
- set { orientation = orientation.WithYaw(value); }
+ get => orientation.Yaw;
+ set => orientation = orientation.WithYaw(value);
}
- public WRot Orientation { get { return orientation; } }
+ public WRot Orientation => orientation;
+
+ public WAngle TurnSpeed => Info.TurnSpeed;
- public WAngle TurnSpeed { get { return Info.TurnSpeed; } }
#endregion
[Sync]
- public CPos FromCell { get { return fromCell; } }
+ public CPos FromCell => fromCell;
[Sync]
- public CPos ToCell { get { return toCell; } }
+ public CPos ToCell => toCell;
[Sync]
public int PathHash; // written by Move.EvalPath, to temporarily debug this crap.
@@ -232,7 +227,7 @@ namespace OpenRA.Mods.Common.Traits
[Sync]
public WPos CenterPosition { get; private set; }
- public CPos TopLeft { get { return ToCell; } }
+ public CPos TopLeft => ToCell;
public (CPos, SubCell)[] OccupiedCells()
{
@@ -989,8 +984,8 @@ namespace OpenRA.Mods.Common.Traits
rejectMove = !self.AcceptsOrder("Move");
}
- public string OrderID { get { return "Move"; } }
- public int OrderPriority { get { return 4; } }
+ public string OrderID => "Move";
+ public int OrderPriority => 4;
public bool IsQueued { get; protected set; }
public bool CanTarget(Actor self, in Target target, List othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
diff --git a/OpenRA.Mods.Common/Traits/Passenger.cs b/OpenRA.Mods.Common/Traits/Passenger.cs
index 7a2735d4ce..0c5308fb80 100644
--- a/OpenRA.Mods.Common/Traits/Passenger.cs
+++ b/OpenRA.Mods.Common/Traits/Passenger.cs
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly Dictionary CargoConditions = new Dictionary();
[GrantedConditionReference]
- public IEnumerable LinterCargoConditions { get { return CargoConditions.Values; } }
+ public IEnumerable LinterCargoConditions => CargoConditions.Values;
[VoiceReference]
public readonly string Voice = "Action";
diff --git a/OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs b/OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs
index 4548eb6e4f..ad8806f4f5 100644
--- a/OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs
+++ b/OpenRA.Mods.Common/Traits/Player/DeveloperMode.cs
@@ -95,13 +95,13 @@ namespace OpenRA.Mods.Common.Traits
[Sync]
bool buildAnywhere;
- public bool FastCharge { get { return Enabled && fastCharge; } }
- public bool AllTech { get { return Enabled && allTech; } }
- public bool FastBuild { get { return Enabled && fastBuild; } }
- public bool DisableShroud { get { return Enabled && disableShroud; } }
- public bool PathDebug { get { return Enabled && pathDebug; } }
- public bool UnlimitedPower { get { return Enabled && unlimitedPower; } }
- public bool BuildAnywhere { get { return Enabled && buildAnywhere; } }
+ public bool FastCharge => Enabled && fastCharge;
+ public bool AllTech => Enabled && allTech;
+ public bool FastBuild => Enabled && fastBuild;
+ public bool DisableShroud => Enabled && disableShroud;
+ public bool PathDebug => Enabled && pathDebug;
+ public bool UnlimitedPower => Enabled && unlimitedPower;
+ public bool BuildAnywhere => Enabled && buildAnywhere;
bool enableAll;
@@ -275,6 +275,6 @@ namespace OpenRA.Mods.Common.Traits
Game.Debug("Cheat used: {0} by {1}{2}", order.OrderString, self.Owner.PlayerName, debugSuffix);
}
- bool IUnlocksRenderPlayer.RenderPlayerUnlocked { get { return Enabled; } }
+ bool IUnlocksRenderPlayer.RenderPlayerUnlocked => Enabled;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Player/DummyBot.cs b/OpenRA.Mods.Common/Traits/Player/DummyBot.cs
index 9309cdb119..3103025af2 100644
--- a/OpenRA.Mods.Common/Traits/Player/DummyBot.cs
+++ b/OpenRA.Mods.Common/Traits/Player/DummyBot.cs
@@ -23,9 +23,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Internal id for this bot.")]
public readonly string Type = null;
- string IBotInfo.Type { get { return Type; } }
+ string IBotInfo.Type => Type;
- string IBotInfo.Name { get { return Name; } }
+ string IBotInfo.Name => Name;
public override object Create(ActorInitializer init) { return new DummyBot(this); }
}
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
void IBot.QueueOrder(Order order) { }
- IBotInfo IBot.Info { get { return info; } }
- Player IBot.Player { get { return player; } }
+ IBotInfo IBot.Info => info;
+ Player IBot.Player => player;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs b/OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs
index ada02395b7..2e126c2d06 100644
--- a/OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs
+++ b/OpenRA.Mods.Common/Traits/Player/MissionObjectives.cs
@@ -276,7 +276,7 @@ namespace OpenRA.Mods.Common.Traits
{
readonly ObjectivesPanelInfo info;
public ObjectivesPanel(ObjectivesPanelInfo info) { this.info = info; }
- public string PanelName { get { return info.PanelName; } }
- public int ExitDelay { get { return info.ExitDelay; } }
+ public string PanelName => info.PanelName;
+ public int ExitDelay => info.ExitDelay;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Player/ModularBot.cs b/OpenRA.Mods.Common/Traits/Player/ModularBot.cs
index e558b3e8e9..4595634af2 100644
--- a/OpenRA.Mods.Common/Traits/Player/ModularBot.cs
+++ b/OpenRA.Mods.Common/Traits/Player/ModularBot.cs
@@ -30,9 +30,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Minimum portion of pending orders to issue each tick (e.g. 5 issues at least 1/5th of all pending orders). Excess orders remain queued for subsequent ticks.")]
public readonly int MinOrderQuotientPerTick = 5;
- string IBotInfo.Type { get { return Type; } }
+ string IBotInfo.Type => Type;
- string IBotInfo.Name { get { return Name; } }
+ string IBotInfo.Name => Name;
public override object Create(ActorInitializer init) { return new ModularBot(this, init); }
}
@@ -50,8 +50,8 @@ namespace OpenRA.Mods.Common.Traits
IBotTick[] tickModules;
IBotRespondToAttack[] attackResponseModules;
- IBotInfo IBot.Info { get { return info; } }
- Player IBot.Player { get { return player; } }
+ IBotInfo IBot.Info => info;
+ Player IBot.Player => player;
public ModularBot(ModularBotInfo info, ActorInitializer init)
{
diff --git a/OpenRA.Mods.Common/Traits/Player/PlayerRadarTerrain.cs b/OpenRA.Mods.Common/Traits/Player/PlayerRadarTerrain.cs
index 41a315f1a3..bc5241af7a 100644
--- a/OpenRA.Mods.Common/Traits/Player/PlayerRadarTerrain.cs
+++ b/OpenRA.Mods.Common/Traits/Player/PlayerRadarTerrain.cs
@@ -81,10 +81,7 @@ namespace OpenRA.Mods.Common.Traits
});
}
- public (int Left, int Right) this[MPos uv]
- {
- get { return terrainColor[uv]; }
- }
+ public (int Left, int Right) this[MPos uv] => terrainColor[uv];
public static (int Left, int Right) GetColor(Map map, MPos uv)
{
diff --git a/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs b/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs
index 26f6b87774..d140e6f9d4 100644
--- a/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs
+++ b/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs
@@ -31,13 +31,7 @@ namespace OpenRA.Mods.Common.Traits
public int OrderCount;
- public int Experience
- {
- get
- {
- return experience != null ? experience.Experience : 0;
- }
- }
+ public int Experience => experience != null ? experience.Experience : 0;
// Low resolution (every 30 seconds) record of earnings, covering the entire game
public List IncomeSamples = new List(100);
diff --git a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs
index 09df74d13d..550b0e9927 100644
--- a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs
+++ b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs
@@ -116,7 +116,7 @@ namespace OpenRA.Mods.Common.Traits
protected DeveloperMode developerMode;
protected TechTree techTree;
- public Actor Actor { get { return self; } }
+ public Actor Actor => self;
[Sync]
public bool Enabled { get; protected set; }
@@ -603,14 +603,9 @@ namespace OpenRA.Mods.Common.Traits
public int TotalTime { get; private set; }
public int RemainingTime { get; private set; }
public int RemainingCost { get; private set; }
- public int RemainingTimeActual
- {
- get
- {
- return (pm == null || pm.PowerState == PowerState.Normal) ? RemainingTime :
- RemainingTime * Queue.Info.LowPowerModifier / 100;
- }
- }
+ public int RemainingTimeActual =>
+ (pm == null || pm.PowerState == PowerState.Normal) ? RemainingTime :
+ RemainingTime * Queue.Info.LowPowerModifier / 100;
public bool Paused { get; private set; }
public bool Done { get; private set; }
diff --git a/OpenRA.Mods.Common/Traits/Player/ProvidesTechPrerequisite.cs b/OpenRA.Mods.Common/Traits/Player/ProvidesTechPrerequisite.cs
index 0be4aa671b..c7d836a36c 100644
--- a/OpenRA.Mods.Common/Traits/Player/ProvidesTechPrerequisite.cs
+++ b/OpenRA.Mods.Common/Traits/Player/ProvidesTechPrerequisite.cs
@@ -37,15 +37,9 @@ namespace OpenRA.Mods.Common.Traits
static readonly string[] NoPrerequisites = new string[0];
- public string Name { get { return info.Name; } }
+ public string Name => info.Name;
- public IEnumerable ProvidesPrerequisites
- {
- get
- {
- return enabled ? info.Prerequisites : NoPrerequisites;
- }
- }
+ public IEnumerable ProvidesPrerequisites => enabled ? info.Prerequisites : NoPrerequisites;
public ProvidesTechPrerequisite(ProvidesTechPrerequisiteInfo info, ActorInitializer init)
{
diff --git a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs
index d3d7efc867..00dc4a9dda 100644
--- a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs
+++ b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs
@@ -66,15 +66,12 @@ namespace OpenRA.Mods.Common.Traits
shortGame = player.World.WorldActor.Trait().ShortGame;
}
- public IEnumerable AllPoints
- {
- get { return player.World.ActorsHavingTrait(); }
- }
+ public IEnumerable AllPoints => player.World.ActorsHavingTrait();
- public int Total { get { return AllPoints.Count(); } }
+ public int Total => AllPoints.Count();
int Owned { get { return AllPoints.Count(a => a.Owner.RelationshipWith(player) == PlayerRelationship.Ally); } }
- public bool Holding { get { return Owned >= info.RatioRequired * Total / 100; } }
+ public bool Holding => Owned >= info.RatioRequired * Total / 100;
void ITick.Tick(Actor self)
{
diff --git a/OpenRA.Mods.Common/Traits/Player/TechTree.cs b/OpenRA.Mods.Common/Traits/Player/TechTree.cs
index 02934ef144..4be7b3bfac 100644
--- a/OpenRA.Mods.Common/Traits/Player/TechTree.cs
+++ b/OpenRA.Mods.Common/Traits/Player/TechTree.cs
@@ -106,12 +106,12 @@ namespace OpenRA.Mods.Common.Traits
return ret;
}
- public Player Owner { get { return player; } }
+ public Player Owner => player;
class Watcher
{
public readonly string Key;
- public ITechTreeElement RegisteredBy { get { return watcher; } }
+ public ITechTreeElement RegisteredBy => watcher;
// Strings may be either actor type, or "alternate name" key
readonly string[] prerequisites;
diff --git a/OpenRA.Mods.Common/Traits/Pluggable.cs b/OpenRA.Mods.Common/Traits/Pluggable.cs
index 80acd261d6..ecedfd5112 100644
--- a/OpenRA.Mods.Common/Traits/Pluggable.cs
+++ b/OpenRA.Mods.Common/Traits/Pluggable.cs
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int EditorDisplayOrder = 5;
[GrantedConditionReference]
- public IEnumerable LinterConditions { get { return Conditions.Values; } }
+ public IEnumerable LinterConditions => Conditions.Values;
[ConsumedConditionReference]
public IEnumerable ConsumedConditions
diff --git a/OpenRA.Mods.Common/Traits/Power/AffectedByPowerOutage.cs b/OpenRA.Mods.Common/Traits/Power/AffectedByPowerOutage.cs
index 6a9e422fc3..6c93458ab2 100644
--- a/OpenRA.Mods.Common/Traits/Power/AffectedByPowerOutage.cs
+++ b/OpenRA.Mods.Common/Traits/Power/AffectedByPowerOutage.cs
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Traits
return Color.Yellow;
}
- bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
+ bool ISelectionBar.DisplayWhenEmpty => false;
public void UpdateStatus(Actor self)
{
diff --git a/OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs b/OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs
index 5b5b00e24c..505d15d1ca 100644
--- a/OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs
+++ b/OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs
@@ -37,14 +37,14 @@ namespace OpenRA.Mods.Common.Traits
[Sync]
int totalProvided;
- public int PowerProvided { get { return totalProvided; } }
+ public int PowerProvided => totalProvided;
[Sync]
int totalDrained;
- public int PowerDrained { get { return totalDrained; } }
+ public int PowerDrained => totalDrained;
- public int ExcessPower { get { return totalProvided - totalDrained; } }
+ public int ExcessPower => totalProvided - totalDrained;
public int PowerOutageRemainingTicks { get; private set; }
public int PowerOutageTotalTicks { get; private set; }
diff --git a/OpenRA.Mods.Common/Traits/PowerTooltip.cs b/OpenRA.Mods.Common/Traits/PowerTooltip.cs
index 72d6734b92..3e028d64b1 100644
--- a/OpenRA.Mods.Common/Traits/PowerTooltip.cs
+++ b/OpenRA.Mods.Common/Traits/PowerTooltip.cs
@@ -37,13 +37,7 @@ namespace OpenRA.Mods.Common.Traits
return forPlayer == self.Owner;
}
- public string TooltipText
- {
- get
- {
- return "Power Usage: {0}{1}".F(powerManager.PowerDrained, developerMode.UnlimitedPower ? "" : "/" + powerManager.PowerProvided);
- }
- }
+ public string TooltipText => "Power Usage: {0}{1}".F(powerManager.PowerDrained, developerMode.UnlimitedPower ? "" : "/" + powerManager.PowerProvided);
public void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
{
diff --git a/OpenRA.Mods.Common/Traits/ProximityCapturable.cs b/OpenRA.Mods.Common/Traits/ProximityCapturable.cs
index 94a26c2566..afdb8ceb47 100644
--- a/OpenRA.Mods.Common/Traits/ProximityCapturable.cs
+++ b/OpenRA.Mods.Common/Traits/ProximityCapturable.cs
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
public class ProximityCapturable : ITick, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyOwnerChanged
{
public readonly Player OriginalOwner;
- public bool Captured { get { return Self.Owner != OriginalOwner; } }
+ public bool Captured => Self.Owner != OriginalOwner;
public ProximityCapturableInfo Info;
public Actor Self;
diff --git a/OpenRA.Mods.Common/Traits/RejectsOrders.cs b/OpenRA.Mods.Common/Traits/RejectsOrders.cs
index b374175bfe..79ebfe48bd 100644
--- a/OpenRA.Mods.Common/Traits/RejectsOrders.cs
+++ b/OpenRA.Mods.Common/Traits/RejectsOrders.cs
@@ -29,8 +29,8 @@ namespace OpenRA.Mods.Common.Traits
public class RejectsOrders : ConditionalTrait
{
- public HashSet Reject { get { return Info.Reject; } }
- public HashSet Except { get { return Info.Except; } }
+ public HashSet Reject => Info.Reject;
+ public HashSet Except => Info.Except;
public RejectsOrders(RejectsOrdersInfo info)
: base(info) { }
diff --git a/OpenRA.Mods.Common/Traits/Render/CashTricklerBar.cs b/OpenRA.Mods.Common/Traits/Render/CashTricklerBar.cs
index 50722c01c6..79d94b3b67 100644
--- a/OpenRA.Mods.Common/Traits/Render/CashTricklerBar.cs
+++ b/OpenRA.Mods.Common/Traits/Render/CashTricklerBar.cs
@@ -51,6 +51,6 @@ namespace OpenRA.Mods.Common.Traits.Render
}
Color ISelectionBar.GetColor() { return info.Color; }
- bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
+ bool ISelectionBar.DisplayWhenEmpty => false;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Render/CustomTerrainDebugOverlay.cs b/OpenRA.Mods.Common/Traits/Render/CustomTerrainDebugOverlay.cs
index 79ffff1d56..813df37329 100644
--- a/OpenRA.Mods.Common/Traits/Render/CustomTerrainDebugOverlay.cs
+++ b/OpenRA.Mods.Common/Traits/Render/CustomTerrainDebugOverlay.cs
@@ -78,6 +78,6 @@ namespace OpenRA.Mods.Common.Traits
}
}
- bool IRenderAnnotations.SpatiallyPartitionable { get { return false; } }
+ bool IRenderAnnotations.SpatiallyPartitionable => false;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Render/DrawLineToTarget.cs b/OpenRA.Mods.Common/Traits/Render/DrawLineToTarget.cs
index 422d2e3943..b7ccabf155 100644
--- a/OpenRA.Mods.Common/Traits/Render/DrawLineToTarget.cs
+++ b/OpenRA.Mods.Common/Traits/Render/DrawLineToTarget.cs
@@ -93,7 +93,7 @@ namespace OpenRA.Mods.Common.Traits
yield return new SpriteRenderable(n.Tile, n.Target.CenterPosition, WVec.Zero, -511, pal, 1f, 1f, float3.Ones, TintModifiers.IgnoreWorldTint, true);
}
- bool IRenderAboveShroud.SpatiallyPartitionable { get { return false; } }
+ bool IRenderAboveShroud.SpatiallyPartitionable => false;
IEnumerable IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr)
{
@@ -130,7 +130,7 @@ namespace OpenRA.Mods.Common.Traits
return renderableCache.ToArray();
}
- bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
+ bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
}
public static class LineTargetExts
diff --git a/OpenRA.Mods.Common/Traits/Render/ProductionBar.cs b/OpenRA.Mods.Common/Traits/Render/ProductionBar.cs
index b91fcf795f..a7ebe25e01 100644
--- a/OpenRA.Mods.Common/Traits/Render/ProductionBar.cs
+++ b/OpenRA.Mods.Common/Traits/Render/ProductionBar.cs
@@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Traits.Render
}
Color ISelectionBar.GetColor() { return Info.Color; }
- bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
+ bool ISelectionBar.DisplayWhenEmpty => false;
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
{
diff --git a/OpenRA.Mods.Common/Traits/Render/ReloadArmamentsBar.cs b/OpenRA.Mods.Common/Traits/Render/ReloadArmamentsBar.cs
index d320898b2c..c746a78fd8 100644
--- a/OpenRA.Mods.Common/Traits/Render/ReloadArmamentsBar.cs
+++ b/OpenRA.Mods.Common/Traits/Render/ReloadArmamentsBar.cs
@@ -54,6 +54,6 @@ namespace OpenRA.Mods.Common.Traits.Render
}
Color ISelectionBar.GetColor() { return info.Color; }
- bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
+ bool ISelectionBar.DisplayWhenEmpty => false;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Render/RenderDebugState.cs b/OpenRA.Mods.Common/Traits/Render/RenderDebugState.cs
index d10cb44ba4..0c8aa38205 100644
--- a/OpenRA.Mods.Common/Traits/Render/RenderDebugState.cs
+++ b/OpenRA.Mods.Common/Traits/Render/RenderDebugState.cs
@@ -98,6 +98,6 @@ namespace OpenRA.Mods.Common.Traits.Render
yield return new TextAnnotationRenderable(font, self.CenterPosition + offset, 0, color, aiSquadInfo);
}
- bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return true; } }
+ bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => true;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Render/RenderDetectionCircle.cs b/OpenRA.Mods.Common/Traits/Render/RenderDetectionCircle.cs
index d7eaa3e1f4..11b2e1eb61 100644
--- a/OpenRA.Mods.Common/Traits/Render/RenderDetectionCircle.cs
+++ b/OpenRA.Mods.Common/Traits/Render/RenderDetectionCircle.cs
@@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common.Traits.Render
info.BorderWidth);
}
- bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
+ bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
void ITick.Tick(Actor self)
{
diff --git a/OpenRA.Mods.Common/Traits/Render/RenderJammerCircle.cs b/OpenRA.Mods.Common/Traits/Render/RenderJammerCircle.cs
index 2ccdcedba0..3767b8a742 100644
--- a/OpenRA.Mods.Common/Traits/Render/RenderJammerCircle.cs
+++ b/OpenRA.Mods.Common/Traits/Render/RenderJammerCircle.cs
@@ -84,6 +84,6 @@ namespace OpenRA.Mods.Common.Traits
}
}
- bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
+ bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs b/OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs
index 4d2b651a00..6b9bc1c45c 100644
--- a/OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs
+++ b/OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs
@@ -123,6 +123,6 @@ namespace OpenRA.Mods.Common.Traits.Render
return RangeCircleRenderables(wr);
}
- bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
+ bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Render/RenderShroudCircle.cs b/OpenRA.Mods.Common/Traits/Render/RenderShroudCircle.cs
index 6b3167d00b..44c491d07b 100644
--- a/OpenRA.Mods.Common/Traits/Render/RenderShroudCircle.cs
+++ b/OpenRA.Mods.Common/Traits/Render/RenderShroudCircle.cs
@@ -96,6 +96,6 @@ namespace OpenRA.Mods.Common.Traits
return RangeCircleRenderables(self, wr);
}
- bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
+ bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs b/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs
index c43042e262..6b656555c7 100644
--- a/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs
+++ b/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs
@@ -118,13 +118,7 @@ namespace OpenRA.Mods.Common.Traits.Render
PaletteReference = null;
}
- public bool IsVisible
- {
- get
- {
- return Animation.DisableFunc == null || !Animation.DisableFunc();
- }
- }
+ public bool IsVisible => Animation.DisableFunc == null || !Animation.DisableFunc();
public bool Tick()
{
diff --git a/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs b/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs
index 2bff688bf5..4693708076 100644
--- a/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs
+++ b/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs
@@ -164,7 +164,8 @@ namespace OpenRA.Mods.Common.Traits.Render
yield return c.ScreenBounds(pos, wr, Info.Scale);
}
- public string Image { get { return Info.Image ?? self.Info.Name; } }
+ public string Image => Info.Image ?? self.Info.Name;
+
public void Add(ModelAnimation m)
{
components.Add(m);
diff --git a/OpenRA.Mods.Common/Traits/Render/SelectionDecorationsBase.cs b/OpenRA.Mods.Common/Traits/Render/SelectionDecorationsBase.cs
index 5b5c480bfe..86f6bc129f 100644
--- a/OpenRA.Mods.Common/Traits/Render/SelectionDecorationsBase.cs
+++ b/OpenRA.Mods.Common/Traits/Render/SelectionDecorationsBase.cs
@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits.Render
return DrawDecorations(self, wr);
}
- bool IRenderAnnotations.SpatiallyPartitionable { get { return true; } }
+ bool IRenderAnnotations.SpatiallyPartitionable => true;
IEnumerable DrawDecorations(Actor self, WorldRenderer wr)
{
diff --git a/OpenRA.Mods.Common/Traits/Render/SupportPowerChargeBar.cs b/OpenRA.Mods.Common/Traits/Render/SupportPowerChargeBar.cs
index b954209987..900dd2fbae 100644
--- a/OpenRA.Mods.Common/Traits/Render/SupportPowerChargeBar.cs
+++ b/OpenRA.Mods.Common/Traits/Render/SupportPowerChargeBar.cs
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits.Render
}
Color ISelectionBar.GetColor() { return Info.Color; }
- bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
+ bool ISelectionBar.DisplayWhenEmpty => false;
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
{
diff --git a/OpenRA.Mods.Common/Traits/Render/TimedConditionBar.cs b/OpenRA.Mods.Common/Traits/Render/TimedConditionBar.cs
index 4eff59a164..efc34fc6f1 100644
--- a/OpenRA.Mods.Common/Traits/Render/TimedConditionBar.cs
+++ b/OpenRA.Mods.Common/Traits/Render/TimedConditionBar.cs
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits.Render
value = duration > 0 ? remaining * 1f / duration : 0;
}
- string IConditionTimerWatcher.Condition { get { return info.Condition; } }
+ string IConditionTimerWatcher.Condition => info.Condition;
float ISelectionBar.GetValue()
{
@@ -54,6 +54,6 @@ namespace OpenRA.Mods.Common.Traits.Render
}
Color ISelectionBar.GetColor() { return info.Color; }
- bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
+ bool ISelectionBar.DisplayWhenEmpty => false;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Render/VeteranProductionIconOverlay.cs b/OpenRA.Mods.Common/Traits/Render/VeteranProductionIconOverlay.cs
index 4cc1d24af7..a00f68e901 100644
--- a/OpenRA.Mods.Common/Traits/Render/VeteranProductionIconOverlay.cs
+++ b/OpenRA.Mods.Common/Traits/Render/VeteranProductionIconOverlay.cs
@@ -69,8 +69,9 @@ namespace OpenRA.Mods.Common.Traits.Render
}
}
- Sprite IProductionIconOverlay.Sprite { get { return sprite; } }
- string IProductionIconOverlay.Palette { get { return info.Palette; } }
+ Sprite IProductionIconOverlay.Sprite => sprite;
+ string IProductionIconOverlay.Palette => info.Palette;
+
float2 IProductionIconOverlay.Offset(float2 iconSize)
{
var x = (sprite.Size.X - iconSize.X) / 2;
diff --git a/OpenRA.Mods.Common/Traits/Render/WithDecorationBase.cs b/OpenRA.Mods.Common/Traits/Render/WithDecorationBase.cs
index 84097c9d5f..c8c321326d 100644
--- a/OpenRA.Mods.Common/Traits/Render/WithDecorationBase.cs
+++ b/OpenRA.Mods.Common/Traits/Render/WithDecorationBase.cs
@@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.Traits.Render
return true;
}
- bool IDecoration.RequiresSelection { get { return Info.RequiresSelection; } }
+ bool IDecoration.RequiresSelection => Info.RequiresSelection;
protected abstract IEnumerable RenderDecoration(Actor self, WorldRenderer wr, int2 pos);
diff --git a/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs b/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs
index 5baefdb9f7..d194f59b22 100644
--- a/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs
+++ b/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits.Render
AnimationState state;
IRenderInfantrySequenceModifier rsm;
- bool IsModifyingSequence { get { return rsm != null && rsm.IsModifyingSequence; } }
+ bool IsModifyingSequence => rsm != null && rsm.IsModifyingSequence;
bool wasModifying;
// Allow subclasses to override the info that we use for rendering
diff --git a/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs b/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs
index b99bc03a3e..f06e45f599 100644
--- a/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs
+++ b/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs
@@ -113,13 +113,13 @@ namespace OpenRA.Mods.Common.Traits.Render
return RenderRangeCircle(self, wr, RangeCircleVisibility.WhenSelected);
}
- bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
+ bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
IEnumerable IRenderAnnotations.RenderAnnotations(Actor self, WorldRenderer wr)
{
return RenderRangeCircle(self, wr, RangeCircleVisibility.Always);
}
- bool IRenderAnnotations.SpatiallyPartitionable { get { return false; } }
+ bool IRenderAnnotations.SpatiallyPartitionable => false;
}
}
diff --git a/OpenRA.Mods.Common/Traits/Render/WithSpriteControlGroupDecoration.cs b/OpenRA.Mods.Common/Traits/Render/WithSpriteControlGroupDecoration.cs
index ad15ac5820..da6e6958a9 100644
--- a/OpenRA.Mods.Common/Traits/Render/WithSpriteControlGroupDecoration.cs
+++ b/OpenRA.Mods.Common/Traits/Render/WithSpriteControlGroupDecoration.cs
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits.Render
anim = new Animation(self.World, Info.Image);
}
- bool IDecoration.RequiresSelection { get { return true; } }
+ bool IDecoration.RequiresSelection => true;
IEnumerable IDecoration.RenderDecoration(Actor self, WorldRenderer wr, ISelectionDecorations container)
{
diff --git a/OpenRA.Mods.Common/Traits/Render/WithTextControlGroupDecoration.cs b/OpenRA.Mods.Common/Traits/Render/WithTextControlGroupDecoration.cs
index 8764a4cf42..e1d2707342 100644
--- a/OpenRA.Mods.Common/Traits/Render/WithTextControlGroupDecoration.cs
+++ b/OpenRA.Mods.Common/Traits/Render/WithTextControlGroupDecoration.cs
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits.Render
label = new CachedTransform(g => g.ToString());
}
- bool IDecoration.RequiresSelection { get { return true; } }
+ bool IDecoration.RequiresSelection => true;
IEnumerable IDecoration.RenderDecoration(Actor self, WorldRenderer wr, ISelectionDecorations container)
{
diff --git a/OpenRA.Mods.Common/Traits/Selectable.cs b/OpenRA.Mods.Common/Traits/Selectable.cs
index c35942fdd1..d583090315 100644
--- a/OpenRA.Mods.Common/Traits/Selectable.cs
+++ b/OpenRA.Mods.Common/Traits/Selectable.cs
@@ -33,9 +33,9 @@ namespace OpenRA.Mods.Common.Traits
public override object Create(ActorInitializer init) { return new Selectable(init.Self, this); }
- int ISelectableInfo.Priority { get { return Priority; } }
- SelectionPriorityModifiers ISelectableInfo.PriorityModifiers { get { return PriorityModifiers; } }
- string ISelectableInfo.Voice { get { return Voice; } }
+ int ISelectableInfo.Priority => Priority;
+ SelectionPriorityModifiers ISelectableInfo.PriorityModifiers => PriorityModifiers;
+ string ISelectableInfo.Voice => Voice;
}
public class Selectable : Interactable, ISelectable
@@ -50,6 +50,6 @@ namespace OpenRA.Mods.Common.Traits
Info = info;
}
- string ISelectable.Class { get { return selectionClass; } }
+ string ISelectable.Class => selectionClass;
}
}
diff --git a/OpenRA.Mods.Common/Traits/StoresResources.cs b/OpenRA.Mods.Common/Traits/StoresResources.cs
index ef7edf23b1..a4f618bede 100644
--- a/OpenRA.Mods.Common/Traits/StoresResources.cs
+++ b/OpenRA.Mods.Common/Traits/StoresResources.cs
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
PlayerResources player;
[Sync]
- public int Stored { get { return player.ResourceCapacity == 0 ? 0 : (int)((long)info.Capacity * player.Resources / player.ResourceCapacity); } }
+ public int Stored => player.ResourceCapacity == 0 ? 0 : (int)((long)info.Capacity * player.Resources / player.ResourceCapacity);
public StoresResources(Actor self, StoresResourcesInfo info)
{
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits
player = self.Owner.PlayerActor.Trait();
}
- int IStoreResources.Capacity { get { return info.Capacity; } }
+ int IStoreResources.Capacity => info.Capacity;
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
{
diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs
index 4513e2db60..6695444c5d 100644
--- a/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs
+++ b/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs
@@ -112,10 +112,7 @@ namespace OpenRA.Mods.Common.Traits
void IOrderGenerator.SelectionChanged(World world, IEnumerable selected) { }
- bool IsOutsideDragZone
- {
- get { return dragStarted && dragDirection.Length > MinDragThreshold; }
- }
+ bool IsOutsideDragZone => dragStarted && dragDirection.Length > MinDragThreshold;
IEnumerable