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

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

View File

@@ -43,7 +43,7 @@ namespace OpenRA.Traits
public Player Owner { get; private set; }
public BitSet<TargetableType> TargetTypes { get; private set; }
public IEnumerable<WPos> TargetablePositions { get { return targetablePositions; } }
public IEnumerable<WPos> 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()
{

View File

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

View File

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