Fix StyleCop warnings in OpenRA.Game
This commit is contained in:
@@ -16,6 +16,5 @@ namespace OpenRA.Traits
|
||||
public readonly string Type = null;
|
||||
}
|
||||
|
||||
public class Armor {}
|
||||
}
|
||||
|
||||
public class Armor { }
|
||||
}
|
||||
@@ -72,7 +72,7 @@ namespace OpenRA.Traits
|
||||
if (target.Type == TargetType.Invalid)
|
||||
continue;
|
||||
|
||||
yield return new TargetLineRenderable(new [] { self.CenterPosition, target.CenterPosition }, c);
|
||||
yield return new TargetLineRenderable(new[] { self.CenterPosition, target.CenterPosition }, c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,5 +131,4 @@ namespace OpenRA.Traits
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Traits
|
||||
public virtual object Create(ActorInitializer init) { return new Health(init, this); }
|
||||
}
|
||||
|
||||
public enum DamageState { Undamaged, Light, Medium, Heavy, Critical, Dead };
|
||||
public enum DamageState { Undamaged, Light, Medium, Heavy, Critical, Dead }
|
||||
|
||||
public class Health : ISync, ITick
|
||||
{
|
||||
@@ -173,8 +173,8 @@ namespace OpenRA.Traits
|
||||
{
|
||||
[FieldFromYamlKey] public readonly float value = 1f;
|
||||
public HealthInit() { }
|
||||
public HealthInit( float init ) { value = init; }
|
||||
public float Value( World world ) { return value; }
|
||||
public HealthInit(float init) { value = init; }
|
||||
public float Value(World world) { return value; }
|
||||
}
|
||||
|
||||
public static class HealthExts
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace OpenRA.Traits
|
||||
if (!self.World.AllowDevCommands)
|
||||
return;
|
||||
|
||||
switch(order.OrderString)
|
||||
switch (order.OrderString)
|
||||
{
|
||||
case "DevEnableTech":
|
||||
{
|
||||
@@ -97,6 +97,7 @@ namespace OpenRA.Traits
|
||||
for (var i = 0; i < Info.ResourceGrowth; i++)
|
||||
a.Trait.Seed(a.Actor);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ namespace OpenRA.Traits
|
||||
|
||||
public class PlayerResources : ITick, ISync
|
||||
{
|
||||
const float displayCashFracPerFrame = .07f;
|
||||
const int displayCashDeltaPerFrame = 37;
|
||||
readonly Player Owner;
|
||||
int AdviceInterval;
|
||||
|
||||
@@ -97,8 +99,6 @@ namespace OpenRA.Traits
|
||||
return true;
|
||||
}
|
||||
|
||||
const float displayCashFracPerFrame = .07f;
|
||||
const int displayCashDeltaPerFrame = 37;
|
||||
int nextSiloAdviceTime = 0;
|
||||
int nextCashTickTime = 0;
|
||||
|
||||
@@ -130,8 +130,7 @@ namespace OpenRA.Traits
|
||||
var diff = Math.Abs(Cash - DisplayCash);
|
||||
var move = Math.Min(Math.Max((int)(diff * displayCashFracPerFrame),
|
||||
displayCashDeltaPerFrame), diff);
|
||||
|
||||
|
||||
|
||||
if (DisplayCash < Cash)
|
||||
{
|
||||
DisplayCash += move;
|
||||
@@ -159,7 +158,6 @@ namespace OpenRA.Traits
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void playCashTickUp(Actor self)
|
||||
{
|
||||
if (Game.Settings.Sound.CashTicks)
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace OpenRA.Traits
|
||||
pipImages.PlayRepeating(pipStrings[0]);
|
||||
|
||||
var pipSize = pipImages.Image.size.ToInt2();
|
||||
var pipxyBase = basePosition + new int2(1 - pipSize.X / 2, - (3 + pipSize.Y / 2));
|
||||
var pipxyBase = basePosition + new int2(1 - pipSize.X / 2, -(3 + pipSize.Y / 2));
|
||||
var pipxyOffset = new int2(0, 0);
|
||||
var pal = wr.Palette(Info.Palette);
|
||||
var width = self.Bounds.Width;
|
||||
@@ -135,7 +135,5 @@ namespace OpenRA.Traits
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Traits
|
||||
public enum TargetType { Invalid, Actor, Terrain, FrozenActor }
|
||||
public struct Target
|
||||
{
|
||||
public static readonly Target[] None = {};
|
||||
public static readonly Target[] None = { };
|
||||
public static readonly Target Invalid = new Target { type = TargetType.Invalid };
|
||||
|
||||
TargetType type;
|
||||
@@ -54,7 +54,7 @@ namespace OpenRA.Traits
|
||||
};
|
||||
}
|
||||
|
||||
public static Target FromFrozenActor(FrozenActor a) { return new Target { frozen = a, type = TargetType.FrozenActor }; }
|
||||
public static Target FromFrozenActor(FrozenActor a) { return new Target { frozen = a, type = TargetType.FrozenActor }; }
|
||||
|
||||
public Actor Actor { get { return actor; } }
|
||||
public FrozenActor FrozenActor { get { return frozen; } }
|
||||
@@ -115,7 +115,7 @@ namespace OpenRA.Traits
|
||||
}
|
||||
|
||||
// Positions available to target for range checks
|
||||
static readonly WPos[] NoPositions = {};
|
||||
static readonly WPos[] NoPositions = { };
|
||||
public IEnumerable<WPos> Positions
|
||||
{
|
||||
get
|
||||
@@ -125,14 +125,14 @@ namespace OpenRA.Traits
|
||||
case TargetType.Actor:
|
||||
var targetable = actor.TraitOrDefault<ITargetable>();
|
||||
if (targetable == null)
|
||||
return new [] { actor.CenterPosition };
|
||||
return new[] { actor.CenterPosition };
|
||||
|
||||
var positions = targetable.TargetablePositions(actor);
|
||||
return positions.Any() ? positions : new [] { actor.CenterPosition };
|
||||
return positions.Any() ? positions : new[] { actor.CenterPosition };
|
||||
case TargetType.FrozenActor:
|
||||
return new [] { frozen.CenterPosition };
|
||||
return new[] { frozen.CenterPosition };
|
||||
case TargetType.Terrain:
|
||||
return new [] { pos };
|
||||
return new[] { pos };
|
||||
default:
|
||||
case TargetType.Invalid:
|
||||
return NoPositions;
|
||||
@@ -146,7 +146,7 @@ namespace OpenRA.Traits
|
||||
return false;
|
||||
|
||||
// Target ranges are calculated in 2D, so ignore height differences
|
||||
var rangeSquared = range.Range*range.Range;
|
||||
var rangeSquared = range.Range * range.Range;
|
||||
return Positions.Any(t => (t - origin).HorizontalLengthSquared <= rangeSquared);
|
||||
}
|
||||
|
||||
@@ -168,6 +168,5 @@ namespace OpenRA.Traits
|
||||
return "Invalid";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ using OpenRA.Primitives;
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
// depends on the order of pips in WorldRenderer.cs!
|
||||
public enum PipType { Transparent, Green, Yellow, Red, Gray, Blue, Ammo, AmmoEmpty };
|
||||
public enum TagType { None, Fake, Primary };
|
||||
public enum PipType { Transparent, Green, Yellow, Red, Gray, Blue, Ammo, AmmoEmpty }
|
||||
public enum TagType { None, Fake, Primary }
|
||||
|
||||
[Flags]
|
||||
public enum Stance
|
||||
@@ -65,7 +65,7 @@ namespace OpenRA.Traits
|
||||
Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued);
|
||||
}
|
||||
|
||||
[Flags] public enum TargetModifiers { None = 0, ForceAttack = 1, ForceQueue = 2, ForceMove = 4 };
|
||||
[Flags] public enum TargetModifiers { None = 0, ForceAttack = 1, ForceQueue = 2, ForceMove = 4 }
|
||||
|
||||
public static class TargetModifiersExts
|
||||
{
|
||||
@@ -173,6 +173,7 @@ namespace OpenRA.Traits
|
||||
nearestDistance = dist;
|
||||
}
|
||||
}
|
||||
|
||||
return nearest;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,9 +91,11 @@ namespace OpenRA.Traits
|
||||
{
|
||||
start = current;
|
||||
}
|
||||
|
||||
if (prev == act)
|
||||
break;
|
||||
}
|
||||
|
||||
return act;
|
||||
}
|
||||
|
||||
|
||||
@@ -476,7 +476,6 @@ namespace OpenRA.Traits
|
||||
yield return bins[j * cols + i];
|
||||
}
|
||||
|
||||
|
||||
public IEnumerable<Actor> ActorsInBox(WPos a, WPos b)
|
||||
{
|
||||
var left = Math.Min(a.X, b.X);
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace OpenRA.Traits
|
||||
|
||||
for (var j = top; j <= bottom; j++)
|
||||
for (var i = left; i <= right; i++)
|
||||
frozen[viewer][j*cols + i].Add(fa, bounds);
|
||||
frozen[viewer][j * cols + i].Add(fa, bounds);
|
||||
}
|
||||
|
||||
public void Remove(Player viewer, FrozenActor fa)
|
||||
@@ -117,7 +117,7 @@ namespace OpenRA.Traits
|
||||
|
||||
var i = (worldPx.X / info.BinSize).Clamp(0, cols - 1);
|
||||
var j = (worldPx.Y / info.BinSize).Clamp(0, rows - 1);
|
||||
return frozen[viewer][j*cols + i]
|
||||
return frozen[viewer][j * cols + i]
|
||||
.Where(kv => kv.Key.IsValid && kv.Value.Contains(worldPx))
|
||||
.Select(kv => kv.Key);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user