Fix StyleCop warnings in OpenRA.Game
This commit is contained in:
@@ -16,7 +16,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
//TODO: This is not exported into the documentation yet.
|
||||
// TODO: This is not exported into the documentation yet.
|
||||
[Desc("A unit/building inside the game. Every rules starts with one and adds trait to it.",
|
||||
"Special actors like world or player are usually defined in system.yaml and affect everything.")]
|
||||
public class ActorInfo
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA
|
||||
public readonly TypeDictionary Traits = new TypeDictionary();
|
||||
List<ITraitInfo> constructOrderCache = null;
|
||||
|
||||
public ActorInfo( string name, MiniYaml node, Dictionary<string, MiniYaml> allUnits )
|
||||
public ActorInfo(string name, MiniYaml node, Dictionary<string, MiniYaml> allUnits)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -46,15 +46,15 @@ namespace OpenRA
|
||||
}
|
||||
}
|
||||
|
||||
static MiniYaml GetParent( MiniYaml node, Dictionary<string, MiniYaml> allUnits )
|
||||
static MiniYaml GetParent(MiniYaml node, Dictionary<string, MiniYaml> allUnits)
|
||||
{
|
||||
MiniYaml inherits;
|
||||
node.ToDictionary().TryGetValue( "Inherits", out inherits );
|
||||
if( inherits == null || string.IsNullOrEmpty( inherits.Value ) )
|
||||
node.ToDictionary().TryGetValue("Inherits", out inherits);
|
||||
if (inherits == null || string.IsNullOrEmpty(inherits.Value))
|
||||
return null;
|
||||
|
||||
MiniYaml parent;
|
||||
allUnits.TryGetValue( inherits.Value, out parent );
|
||||
allUnits.TryGetValue(inherits.Value, out parent);
|
||||
if (parent == null)
|
||||
throw new InvalidOperationException(
|
||||
"Bogus inheritance -- actor type {0} does not exist".F(inherits.Value));
|
||||
@@ -62,9 +62,9 @@ namespace OpenRA
|
||||
return parent;
|
||||
}
|
||||
|
||||
static MiniYaml MergeWithParent( MiniYaml node, Dictionary<string, MiniYaml> allUnits )
|
||||
static MiniYaml MergeWithParent(MiniYaml node, Dictionary<string, MiniYaml> allUnits)
|
||||
{
|
||||
var parent = GetParent( node, allUnits );
|
||||
var parent = GetParent(node, allUnits);
|
||||
if (parent != null)
|
||||
{
|
||||
var result = MiniYaml.MergeStrict(node, MergeWithParent(parent, allUnits));
|
||||
@@ -73,6 +73,7 @@ namespace OpenRA
|
||||
result.Nodes.RemoveAll(a => a.Key.StartsWith("-"));
|
||||
return result;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
@@ -101,7 +102,7 @@ namespace OpenRA
|
||||
var unresolved = source.Except(resolved);
|
||||
|
||||
var testResolve = new Func<Type, Type, bool>((a, b) => a == b || a.IsAssignableFrom(b));
|
||||
var more = unresolved.Where(u => u.Dependencies.All( d => resolved.Exists(r => testResolve(d, r.Type)) ));
|
||||
var more = unresolved.Where(u => u.Dependencies.All(d => resolved.Exists(r => testResolve(d, r.Type))));
|
||||
|
||||
// Re-evaluate the vars above until sorted
|
||||
while (more.Any())
|
||||
@@ -146,11 +147,11 @@ namespace OpenRA
|
||||
.Where(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(UsesInit<>))
|
||||
.Select(i => i.GetGenericArguments()[0])).ToList();
|
||||
|
||||
inits.Add( typeof(OwnerInit) ); /* not exposed by a trait; this is used by the Actor itself */
|
||||
inits.Add(typeof(OwnerInit)); /* not exposed by a trait; this is used by the Actor itself */
|
||||
|
||||
return inits.Select(
|
||||
i => Pair.New(
|
||||
i.Name.Replace( "Init", "" ), i ));
|
||||
i.Name.Replace("Init", ""), i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,13 +20,13 @@ namespace OpenRA.GameRules
|
||||
public int Length { get; private set; } // seconds
|
||||
public bool Exists { get; private set; }
|
||||
|
||||
public MusicInfo( string key, MiniYaml value )
|
||||
public MusicInfo(string key, MiniYaml value)
|
||||
{
|
||||
Title = value.Value;
|
||||
|
||||
var nd = value.ToDictionary();
|
||||
var ext = nd.ContainsKey("Extension") ? nd["Extension"].Value : "aud";
|
||||
Filename = (nd.ContainsKey("Filename") ? nd["Filename"].Value : key)+"."+ext;
|
||||
Filename = (nd.ContainsKey("Filename") ? nd["Filename"].Value : key) + "." + ext;
|
||||
if (!GlobalFileSystem.Exists(Filename))
|
||||
return;
|
||||
|
||||
|
||||
@@ -16,12 +16,12 @@ namespace OpenRA.GameRules
|
||||
{
|
||||
public class SoundInfo
|
||||
{
|
||||
[FieldLoader.Ignore] public readonly Dictionary<string,string[]> Variants;
|
||||
[FieldLoader.Ignore] public readonly Dictionary<string,string[]> Prefixes;
|
||||
[FieldLoader.Ignore] public readonly Dictionary<string,string[]> Voices;
|
||||
[FieldLoader.Ignore] public readonly Dictionary<string,string[]> Notifications;
|
||||
public readonly string DefaultVariant = ".aud" ;
|
||||
public readonly string DefaultPrefix = "" ;
|
||||
[FieldLoader.Ignore] public readonly Dictionary<string, string[]> Variants;
|
||||
[FieldLoader.Ignore] public readonly Dictionary<string, string[]> Prefixes;
|
||||
[FieldLoader.Ignore] public readonly Dictionary<string, string[]> Voices;
|
||||
[FieldLoader.Ignore] public readonly Dictionary<string, string[]> Notifications;
|
||||
public readonly string DefaultVariant = ".aud";
|
||||
public readonly string DefaultPrefix = "";
|
||||
public readonly string[] DisableVariants = { };
|
||||
public readonly string[] DisablePrefixes = { };
|
||||
|
||||
@@ -36,16 +36,16 @@ namespace OpenRA.GameRules
|
||||
public readonly Lazy<Dictionary<string, SoundPool>> VoicePools;
|
||||
public readonly Lazy<Dictionary<string, SoundPool>> NotificationsPools;
|
||||
|
||||
public SoundInfo( MiniYaml y )
|
||||
public SoundInfo(MiniYaml y)
|
||||
{
|
||||
FieldLoader.Load( this, y );
|
||||
FieldLoader.Load(this, y);
|
||||
Variants = Load(y, "Variants");
|
||||
Prefixes = Load(y, "Prefixes");
|
||||
Voices = Load(y, "Voices");
|
||||
Notifications = Load(y, "Notifications");
|
||||
|
||||
VoicePools = Exts.Lazy(() => Voices.ToDictionary(a => a.Key, a => new SoundPool(a.Value)));
|
||||
NotificationsPools = Exts.Lazy(() => Notifications.ToDictionary( a => a.Key, a => new SoundPool(a.Value) ));
|
||||
NotificationsPools = Exts.Lazy(() => Notifications.ToDictionary(a => a.Key, a => new SoundPool(a.Value)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,13 +30,13 @@ namespace OpenRA.GameRules
|
||||
[Desc("Can this warhead affect the actor that fired it.")]
|
||||
public readonly bool AffectsParent = false;
|
||||
|
||||
[Desc("Delay in ticks before applying the warhead effect.","0 = instant (old model).")]
|
||||
[Desc("Delay in ticks before applying the warhead effect.", "0 = instant (old model).")]
|
||||
public readonly int Delay = 0;
|
||||
|
||||
///<summary>Applies the warhead's effect against the target.</summary>
|
||||
/// <summary>Applies the warhead's effect against the target.</summary>
|
||||
public abstract void DoImpact(Target target, Actor firedBy, IEnumerable<int> damageModifiers);
|
||||
|
||||
///<summary>Checks if the warhead is valid against (can do something to) the target.</summary>
|
||||
/// <summary>Checks if the warhead is valid against (can do something to) the target.</summary>
|
||||
public bool IsValidAgainst(Target target, World world, Actor firedBy)
|
||||
{
|
||||
if (target.Type == TargetType.Actor)
|
||||
@@ -66,7 +66,7 @@ namespace OpenRA.GameRules
|
||||
// assumption has been removed from the yaml definitions
|
||||
public virtual bool CanTargetActor(ActorInfo victim, Actor firedBy) { return false; }
|
||||
|
||||
///<summary>Checks if the warhead is valid against (can do something to) the actor.</summary>
|
||||
/// <summary>Checks if the warhead is valid against (can do something to) the actor.</summary>
|
||||
public bool IsValidAgainst(Actor victim, Actor firedBy)
|
||||
{
|
||||
if (!CanTargetActor(victim.Info, firedBy))
|
||||
@@ -88,7 +88,7 @@ namespace OpenRA.GameRules
|
||||
return true;
|
||||
}
|
||||
|
||||
///<summary>Checks if the warhead is valid against (can do something to) the frozen actor.</summary>
|
||||
/// <summary>Checks if the warhead is valid against (can do something to) the frozen actor.</summary>
|
||||
public bool IsValidAgainst(FrozenActor victim, Actor firedBy)
|
||||
{
|
||||
if (!CanTargetActor(victim.Info, firedBy))
|
||||
|
||||
Reference in New Issue
Block a user