Fix StyleCop warnings in OpenRA.Mods.RA

This commit is contained in:
Hellhake
2015-01-01 23:03:55 +01:00
parent e9989496c4
commit b6410bc1e0
134 changed files with 261 additions and 267 deletions

View File

@@ -37,6 +37,7 @@ namespace OpenRA.Mods.RA.Activities
if (info.Explosion != null)
{
var weapon = self.World.Map.Rules.Weapons[info.Explosion.ToLowerInvariant()];
// Use .FromPos since this actor is killed. Cannot use Target.FromActor
weapon.Impact(Target.FromPos(self.CenterPosition), self, Enumerable.Empty<int>());
}

View File

@@ -71,7 +71,7 @@ namespace OpenRA.Mods.RA.Activities
var desiredFacing = Util.GetFacing(d, plane.Facing);
// Don't turn until we've reached the cruise altitude
if (plane.CenterPosition.Z < plane.Info.CruiseAltitude.Range)
if (plane.CenterPosition.Z < plane.Info.CruiseAltitude.Range)
desiredFacing = plane.Facing;
FlyToward(self, plane, desiredFacing, plane.Info.CruiseAltitude);

View File

@@ -46,6 +46,7 @@ namespace OpenRA.Mods.RA.Activities
else
inner = Util.SequenceActivities(new Fly(self, target), new FlyTimed(ticksUntilTurn));
}
inner = Util.RunActivity(self, inner);
return this;

View File

@@ -55,6 +55,7 @@ namespace OpenRA.Mods.RA.Activities
heli.UnReserve();
heli.Reservation = res.Reserve(dest, self, heli);
}
var exit = dest.Info.Traits.WithInterface<ExitInfo>().FirstOrDefault();
var offset = (exit != null) ? exit.SpawnOffset : WVec.Zero;

View File

@@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA.Activities
public override Activity Tick(Actor self)
{
var ret = InnerTick(self, attack);
attack.IsAttacking = (ret == this);
attack.IsAttacking = ret == this;
return ret;
}

View File

@@ -19,11 +19,10 @@ namespace OpenRA.Mods.RA.Activities
{
public class DeliverResources : Activity
{
const int NextChooseTime = 100;
bool isDocking;
int chosenTicks;
const int NextChooseTime = 100;
public override Activity Tick(Actor self)
{
if (NextActivity != null)

View File

@@ -12,8 +12,8 @@ using System.Collections.Generic;
using System.Linq;
using OpenRA.Activities;
using OpenRA.Effects;
using OpenRA.Traits;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
{

View File

@@ -77,6 +77,7 @@ namespace OpenRA.Mods.RA.Activities
});
}
}
return this;
}
}

View File

@@ -69,6 +69,7 @@ namespace OpenRA.Mods.RA.Activities
var resType = resLayer.GetResource(loc);
if (resType == null) return 1;
// Can the harvester collect this kind of resource?
if (!harvInfo.Resources.Contains(resType.Info.Name)) return 1;
@@ -81,8 +82,7 @@ namespace OpenRA.Mods.RA.Activities
return 0;
})
.FromPoint(self.Location)
);
.FromPoint(self.Location));
if (path.Count == 0)
{

View File

@@ -18,7 +18,6 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
{
// assumes you have Minelayer on that unit
class LayMines : Activity
{
public override Activity Tick(Actor self)
@@ -30,6 +29,7 @@ namespace OpenRA.Mods.RA.Activities
if (!limitedAmmo.HasAmmo())
{
var info = self.Info.Traits.Get<MinelayerInfo>();
// rearm & repair at fix, then back out here to refill the minefield some more
var buildings = info.RearmBuildings;
var rearmTarget = self.World.Actors.Where(a => self.Owner.Stances[a.Owner] == Stance.Ally
@@ -56,16 +56,16 @@ namespace OpenRA.Mods.RA.Activities
if (ml.Minefield.Length > 0)
{
for (var n = 0; n < 20; n++) // dont get stuck forever here
// dont get stuck forever here
for (var n = 0; n < 20; n++)
{
var p = ml.Minefield.Random(self.World.SharedRandom);
if (ShouldLayMine(self, p))
return Util.SequenceActivities( movement.MoveTo(p, 0), this );
return Util.SequenceActivities(movement.MoveTo(p, 0), this);
}
}
// TODO: return somewhere likely to be safe (near fix) so we're not sitting out in the minefield.
return new Wait(20); // nothing to do here
}

View File

@@ -63,7 +63,7 @@ namespace OpenRA.Mods.RA.Activities
mobile.IsMoving = false;
self.World.ActorMap.GetUnitsAt(mobile.toCell, mobile.toSubCell)
.Except(new []{self}).Where(t => weapon.IsValidAgainst(t, self))
.Except(new[] { self }).Where(t => weapon.IsValidAgainst(t, self))
.Do(t => t.Kill(self));
return NextActivity;

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA
{
public class RAHarvesterDockSequence : Activity
{
enum State { Wait, Turn, Dock, Loop, Undock, Complete };
enum State { Wait, Turn, Dock, Loop, Undock, Complete }
readonly Actor proc;
readonly int angle;
@@ -82,10 +82,9 @@ namespace OpenRA.Mods.RA
base.Cancel(self);
}
public override IEnumerable<Target> GetTargets( Actor self )
public override IEnumerable<Target> GetTargets(Actor self)
{
yield return Target.FromActor(proc);
}
}
}
}

View File

@@ -22,6 +22,7 @@ namespace OpenRA.Mods.RA.Activities
public class Teleport : Activity
{
const int maxCellSearchRange = Map.MaxTilesInCircleRange;
Actor teleporter;
CPos destination;
int? maximumDistance;
@@ -29,8 +30,6 @@ namespace OpenRA.Mods.RA.Activities
bool screenFlash;
string sound;
const int maxCellSearchRange = Map.MaxTilesInCircleRange;
public Teleport(Actor teleporter, CPos destination, int? maximumDistance, bool killCargo, bool screenFlash, string sound)
{
if (maximumDistance > maxCellSearchRange)
@@ -74,6 +73,7 @@ namespace OpenRA.Mods.RA.Activities
while (!cargo.IsEmpty(self))
{
var a = cargo.Unload(self);
// Kill all the units that are unloaded into the void
// Kill() handles kill and death statistics
a.Kill(teleporter);

View File

@@ -74,6 +74,7 @@ namespace OpenRA.Mods.RA.Activities
foreach (var nbm in blocker.TraitsImplementing<INotifyBlockingMove>())
nbm.OnNotifyBlockingMove(blocker, self);
}
return Util.SequenceActivities(new Wait(10), this);
}