Simplify return statements.

Remove redundant ‘this’.
Remove unused using directives.
Simplify LINQ chains.
Add some trait property descriptions.
Add readonly where viable.
Add fullstops to some yaml descriptions.
This commit is contained in:
Taryn Hill
2015-04-01 11:16:04 -05:00
parent 14e9cfd433
commit 4ed53c5952
54 changed files with 59 additions and 109 deletions

View File

@@ -15,8 +15,8 @@ namespace OpenRA
{
public class Group
{
Actor[] actors;
int id;
readonly Actor[] actors;
readonly int id;
static int nextGroup;

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Traits
public class CreatesShroud : ITick, ISync
{
CreatesShroudInfo info;
readonly CreatesShroudInfo info;
[Sync] CPos cachedLocation;
[Sync] bool cachedDisabled;

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Traits
public class DebugPauseState : ISync
{
World world;
readonly World world;
[Sync] public bool Paused { get { return world.Paused; } }
public DebugPauseState(World world) { this.world = world; }
}

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Traits
public void SetTarget(Actor self, Target target, Color c, bool display)
{
this.targets = new List<Target> { target };
targets = new List<Target> { target };
this.c = c;
if (display)

View File

@@ -110,7 +110,7 @@ namespace OpenRA.Traits
if (IsDead)
return;
var oldState = this.DamageState;
var oldState = DamageState;
// Apply any damage modifiers
if (!ignoreModifiers && damage > 0)
@@ -128,7 +128,7 @@ namespace OpenRA.Traits
{
Attacker = attacker,
Damage = damage,
DamageState = this.DamageState,
DamageState = DamageState,
PreviousDamageState = oldState,
Warhead = warhead,
};

View File

@@ -12,7 +12,7 @@ using System;
namespace OpenRA.Traits
{
/* attributes used by RALint to understand the rules */
/* attributes used by OpenRA.Lint to understand the rules */
[AttributeUsage(AttributeTargets.Field)]
public sealed class ActorReferenceAttribute : Attribute { }

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Traits
public class RevealsShroud : ITick, ISync
{
RevealsShroudInfo info;
readonly RevealsShroudInfo info;
[Sync] CPos cachedLocation;
public RevealsShroud(RevealsShroudInfo info)

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Traits
public class Selectable : IPostRenderSelection
{
public SelectableInfo Info;
Actor self;
readonly Actor self;
public Selectable(Actor self, SelectableInfo info)
{

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Traits
static readonly string[] TagStrings = { "", "tag-fake", "tag-primary" };
public SelectionDecorationsInfo Info;
Actor self;
readonly Actor self;
public SelectionDecorations(Actor self, SelectionDecorationsInfo info)
{