StyleCop clean OpenRA.Game
This commit is contained in:
@@ -19,17 +19,17 @@ namespace OpenRA
|
||||
public readonly Actor self;
|
||||
public World world { get { return self.World; } }
|
||||
|
||||
internal TypeDictionary dict;
|
||||
internal TypeDictionary Dict;
|
||||
|
||||
public ActorInitializer(Actor actor, TypeDictionary dict)
|
||||
{
|
||||
this.self = actor;
|
||||
this.dict = dict;
|
||||
self = actor;
|
||||
Dict = dict;
|
||||
}
|
||||
|
||||
public T Get<T>() where T : IActorInit { return dict.Get<T>(); }
|
||||
public U Get<T, U>() where T : IActorInit<U> { return dict.Get<T>().Value(world); }
|
||||
public bool Contains<T>() where T : IActorInit { return dict.Contains<T>(); }
|
||||
public T Get<T>() where T : IActorInit { return Dict.Get<T>(); }
|
||||
public U Get<T, U>() where T : IActorInit<U> { return Dict.Get<T>().Value(world); }
|
||||
public bool Contains<T>() where T : IActorInit { return Dict.Contains<T>(); }
|
||||
}
|
||||
|
||||
public interface IActorInit { }
|
||||
@@ -41,7 +41,7 @@ namespace OpenRA
|
||||
|
||||
public class FacingInit : IActorInit<int>
|
||||
{
|
||||
[FieldFromYamlKey] public readonly int value = 128;
|
||||
[FieldFromYamlKey] readonly int value = 128;
|
||||
public FacingInit() { }
|
||||
public FacingInit(int init) { value = init; }
|
||||
public int Value(World world) { return value; }
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA
|
||||
|
||||
public class TurretFacingInit : IActorInit<int>
|
||||
{
|
||||
[FieldFromYamlKey] public readonly int value = 128;
|
||||
[FieldFromYamlKey] readonly int value = 128;
|
||||
public TurretFacingInit() { }
|
||||
public TurretFacingInit(int init) { value = init; }
|
||||
public int Value(World world) { return value; }
|
||||
@@ -57,7 +57,7 @@ namespace OpenRA
|
||||
|
||||
public class LocationInit : IActorInit<CPos>
|
||||
{
|
||||
[FieldFromYamlKey] public readonly CPos value = CPos.Zero;
|
||||
[FieldFromYamlKey] readonly CPos value = CPos.Zero;
|
||||
public LocationInit() { }
|
||||
public LocationInit(CPos init) { value = init; }
|
||||
public CPos Value(World world) { return value; }
|
||||
@@ -65,7 +65,7 @@ namespace OpenRA
|
||||
|
||||
public class SubCellInit : IActorInit<SubCell>
|
||||
{
|
||||
[FieldFromYamlKey] public readonly int value = (int)SubCell.FullCell;
|
||||
[FieldFromYamlKey] readonly int value = (int)SubCell.FullCell;
|
||||
public SubCellInit() { }
|
||||
public SubCellInit(int init) { value = init; }
|
||||
public SubCellInit(SubCell init) { value = (int)init; }
|
||||
@@ -74,7 +74,7 @@ namespace OpenRA
|
||||
|
||||
public class CenterPositionInit : IActorInit<WPos>
|
||||
{
|
||||
[FieldFromYamlKey] public readonly WPos value = WPos.Zero;
|
||||
[FieldFromYamlKey] readonly WPos value = WPos.Zero;
|
||||
public CenterPositionInit() { }
|
||||
public CenterPositionInit(WPos init) { value = init; }
|
||||
public WPos Value(World world) { return value; }
|
||||
|
||||
@@ -385,7 +385,7 @@ namespace OpenRA
|
||||
{
|
||||
return Actors.Value.Values
|
||||
.Where(a => a.Type == "mpspawn")
|
||||
.Select(a => (CPos)a.InitDict.Get<LocationInit>().value)
|
||||
.Select(a => (CPos)a.InitDict.Get<LocationInit>().Value(null))
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
@@ -847,7 +847,7 @@ namespace OpenRA
|
||||
return new WRange(Math.Min(x, y) * dir.Length);
|
||||
}
|
||||
|
||||
static CVec[][] TilesByDistance = InitTilesByDistance(MaxTilesInCircleRange);
|
||||
static readonly CVec[][] TilesByDistance = InitTilesByDistance(MaxTilesInCircleRange);
|
||||
|
||||
static CVec[][] InitTilesByDistance(int max)
|
||||
{
|
||||
|
||||
5
OpenRA.Game/Map/MapPreview.cs
Executable file → Normal file
5
OpenRA.Game/Map/MapPreview.cs
Executable file → Normal file
@@ -11,6 +11,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -28,7 +29,9 @@ namespace OpenRA
|
||||
// Used for verifying map availability in the lobby
|
||||
public enum MapRuleStatus { Unknown, Cached, Invalid }
|
||||
|
||||
// Fields names must match the with the remote API
|
||||
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:AccessibleFieldsMustBeginWithUpperCaseLetter", Justification = "Fields names must match the with the remote API.")]
|
||||
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1304:NonPrivateReadonlyFieldsMustBeginWithUpperCaseLetter", Justification = "Fields names must match the with the remote API.")]
|
||||
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:FieldNamesMustNotContainUnderscore", Justification = "Fields names must match the with the remote API.")]
|
||||
public class RemoteMapData
|
||||
{
|
||||
public readonly string title;
|
||||
|
||||
Reference in New Issue
Block a user