Use read-only autoimplemented property when possible
This commit is contained in:
committed by
atlimit8
parent
79f321cb44
commit
7eb64ea6fc
@@ -426,7 +426,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
public string OrderID { get; private set; }
|
||||
public int OrderPriority { get; private set; }
|
||||
public int OrderPriority { get; }
|
||||
public bool TargetOverridesSelection(Actor self, in Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
|
||||
|
||||
bool CanTargetActor(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor)
|
||||
|
||||
@@ -279,7 +279,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
readonly CPos[] transitOnlyCells;
|
||||
|
||||
public CPos TopLeft => topLeft;
|
||||
public WPos CenterPosition { get; private set; }
|
||||
public WPos CenterPosition { get; }
|
||||
|
||||
public Building(ActorInitializer init, BuildingInfo info)
|
||||
{
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
public int HP => hp;
|
||||
public int MaxHP { get; private set; }
|
||||
public int MaxHP { get; }
|
||||
|
||||
public bool IsDead => hp <= 0;
|
||||
public bool RemoveOnDeath = true;
|
||||
|
||||
@@ -651,7 +651,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public bool Started { get; private set; }
|
||||
public int Slowdown { get; private set; }
|
||||
public bool Infinite { get; set; }
|
||||
public int BuildPaletteOrder { get; private set; }
|
||||
public int BuildPaletteOrder { get; }
|
||||
|
||||
readonly ActorInfo ai;
|
||||
readonly BuildableInfo bi;
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
RallyPoint rp;
|
||||
|
||||
public string Faction { get; private set; }
|
||||
public string Faction { get; }
|
||||
|
||||
public Production(ActorInitializer init, ProductionInfo info)
|
||||
: base(info)
|
||||
|
||||
@@ -177,9 +177,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
class Arrow
|
||||
{
|
||||
public Sprite Sprite { get; private set; }
|
||||
public double EndAngle { get; private set; }
|
||||
public WAngle Direction { get; private set; }
|
||||
public Sprite Sprite { get; }
|
||||
public double EndAngle { get; }
|
||||
public WAngle Direction { get; }
|
||||
|
||||
public Arrow(Sprite sprite, double endAngle, WAngle direction)
|
||||
{
|
||||
|
||||
@@ -185,8 +185,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
readonly HashSet<Actor> removeActorPosition = new HashSet<Actor>();
|
||||
readonly Predicate<Actor> actorShouldBeRemoved;
|
||||
|
||||
public WDist LargestActorRadius { get; private set; }
|
||||
public WDist LargestBlockingActorRadius { get; private set; }
|
||||
public WDist LargestActorRadius { get; }
|
||||
public WDist LargestBlockingActorRadius { get; }
|
||||
|
||||
public ActorMap(World world, ActorMapInfo info)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class ControlGroups : IControlGroups, ITick, IGameSaveTraitData
|
||||
{
|
||||
readonly World world;
|
||||
public string[] Groups { get; private set; }
|
||||
public string[] Groups { get; }
|
||||
|
||||
readonly List<Actor>[] controlGroups;
|
||||
|
||||
|
||||
@@ -161,15 +161,15 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
}
|
||||
|
||||
public string Text { get; private set; }
|
||||
public string Text { get; }
|
||||
|
||||
public EditorActionStatus Status { get; set; }
|
||||
}
|
||||
|
||||
public class EditorActionContainer
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public IEditorAction Action { get; private set; }
|
||||
public int Id { get; }
|
||||
public IEditorAction Action { get; }
|
||||
public EditorActionStatus Status { get; set; }
|
||||
|
||||
public EditorActionContainer(int id, IEditorAction action)
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public string ID { get; set; }
|
||||
public PlayerReference Owner { get; set; }
|
||||
public SubCell SubCell { get; private set; }
|
||||
public SubCell SubCell { get; }
|
||||
public bool Selected { get; set; }
|
||||
public Color RadarColor { get; private set; }
|
||||
readonly RadarColorFromTerrainInfo terrainRadarColorInfo;
|
||||
|
||||
Reference in New Issue
Block a user