Use expression body syntax

This commit is contained in:
teinarss
2021-02-25 20:52:13 +01:00
committed by Paul Chote
parent 555c43843b
commit 4a1e4f3e16
403 changed files with 1342 additions and 2031 deletions

View File

@@ -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;
}
}

View File

@@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Traits
Dictionary<CPos, byte> 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)
{

View File

@@ -236,6 +236,6 @@ namespace OpenRA.Mods.Common.Traits
}
}
public bool Repairing { get { return repairStep < segmentLocations.Count; } }
public bool Repairing => repairStep < segmentLocations.Count;
}
}

View File

@@ -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;
}
}

View File

@@ -244,7 +244,7 @@ namespace OpenRA.Mods.Common.Traits
return new ReadOnlyDictionary<CPos, SubCell>(occupied);
}
bool IOccupySpaceInfo.SharesCell { get { return false; } }
bool IOccupySpaceInfo.SharesCell => false;
public IEnumerable<IRenderable> 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)

View File

@@ -129,6 +129,6 @@ namespace OpenRA.Mods.Common.Traits
void IPlaceBuildingPreview.Tick() { TickInner(); }
int2 IPlaceBuildingPreview.TopLeftScreenOffset { get { return topLeftScreenOffset; } }
int2 IPlaceBuildingPreview.TopLeftScreenOffset => topLeftScreenOffset;
}
}

View File

@@ -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);
}
}

View File

@@ -30,6 +30,6 @@ namespace OpenRA.Mods.Common.Traits
readonly HashSet<string> noAreaTypes = new HashSet<string>();
public HashSet<string> AreaTypes { get { return !IsTraitDisabled ? Info.AreaTypes : noAreaTypes; } }
public HashSet<string> AreaTypes => !IsTraitDisabled ? Info.AreaTypes : noAreaTypes;
}
}

View File

@@ -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;
}
}

View File

@@ -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)

View File

@@ -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<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
public bool ForceSet { get; private set; }
public bool IsQueued { get; protected set; }

View File

@@ -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)
{

View File

@@ -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<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)

View File

@@ -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<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)