StyleCop clean Map/*.cs files
This commit is contained in:
@@ -8,8 +8,8 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace OpenRA.FileFormats
|
||||
{
|
||||
@@ -30,8 +30,8 @@ namespace OpenRA.FileFormats
|
||||
|
||||
// ColorRamp naming retained for backward compatibility
|
||||
public bool LockColor = false;
|
||||
public HSLColor ColorRamp = new HSLColor(0,0,238);
|
||||
public HSLColor Color { get { return ColorRamp; } set { ColorRamp = value; }}
|
||||
public HSLColor ColorRamp = new HSLColor(0, 0, 238);
|
||||
public HSLColor Color { get { return ColorRamp; } set { ColorRamp = value; } }
|
||||
|
||||
public bool LockSpawn = false;
|
||||
public int Spawn = 0;
|
||||
@@ -39,10 +39,10 @@ namespace OpenRA.FileFormats
|
||||
public bool LockTeam = false;
|
||||
public int Team = 0;
|
||||
|
||||
public string[] Allies = {};
|
||||
public string[] Enemies = {};
|
||||
public string[] Allies = { };
|
||||
public string[] Enemies = { };
|
||||
|
||||
public PlayerReference() {}
|
||||
public PlayerReference() { }
|
||||
public PlayerReference(MiniYaml my) { FieldLoader.Load(this, my); }
|
||||
|
||||
public override string ToString() { return Name; }
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace OpenRA.FileFormats
|
||||
public readonly int2 Location;
|
||||
public readonly int Depth;
|
||||
|
||||
public SmudgeReference( string type, int2 location, int depth )
|
||||
public SmudgeReference(string type, int2 location, int depth)
|
||||
{
|
||||
Type = type;
|
||||
Location = location;
|
||||
|
||||
@@ -12,15 +12,15 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
public struct TileReference<T, U>
|
||||
{
|
||||
public T type;
|
||||
public U index;
|
||||
public T Type;
|
||||
public U Index;
|
||||
|
||||
public TileReference(T t, U i)
|
||||
{
|
||||
type = t;
|
||||
index = i;
|
||||
Type = t;
|
||||
Index = i;
|
||||
}
|
||||
|
||||
public override int GetHashCode() { return type.GetHashCode() ^ index.GetHashCode(); }
|
||||
public override int GetHashCode() { return Type.GetHashCode() ^ Index.GetHashCode(); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OpenRA.FileFormats
|
||||
public Color Color;
|
||||
public string CustomCursor;
|
||||
|
||||
public TerrainTypeInfo() {}
|
||||
public TerrainTypeInfo() { }
|
||||
public TerrainTypeInfo(MiniYaml my) { FieldLoader.Load(this, my); }
|
||||
|
||||
public MiniYaml Save() { return FieldSaver.Save(this); }
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.FileFormats
|
||||
[FieldLoader.LoadUsing("LoadTiles")]
|
||||
public Dictionary<byte, string> Tiles = new Dictionary<byte, string>();
|
||||
|
||||
public TileTemplate() {}
|
||||
public TileTemplate() { }
|
||||
public TileTemplate(MiniYaml my) { FieldLoader.Load(this, my); }
|
||||
|
||||
static object LoadTiles(MiniYaml y)
|
||||
@@ -87,9 +87,9 @@ namespace OpenRA.FileFormats
|
||||
public Dictionary<ushort, TileTemplate> Templates = new Dictionary<ushort, TileTemplate>();
|
||||
public string[] EditorTemplateOrder;
|
||||
|
||||
static readonly string[] fields = {"Name", "TileSize", "Id", "SheetSize", "Palette", "Extensions"};
|
||||
static readonly string[] Fields = { "Name", "TileSize", "Id", "SheetSize", "Palette", "Extensions" };
|
||||
|
||||
public TileSet() {}
|
||||
public TileSet() { }
|
||||
|
||||
public TileSet(string filepath)
|
||||
{
|
||||
@@ -112,9 +112,9 @@ namespace OpenRA.FileFormats
|
||||
var root = new List<MiniYamlNode>();
|
||||
var gen = new List<MiniYamlNode>();
|
||||
|
||||
foreach (var field in fields)
|
||||
foreach (var field in Fields)
|
||||
{
|
||||
FieldInfo f = this.GetType().GetField(field);
|
||||
var f = this.GetType().GetField(field);
|
||||
if (f.GetValue(this) == null)
|
||||
continue;
|
||||
|
||||
@@ -123,23 +123,19 @@ namespace OpenRA.FileFormats
|
||||
|
||||
root.Add(new MiniYamlNode("General", null, gen));
|
||||
|
||||
root.Add(new MiniYamlNode( "Terrain", null,
|
||||
Terrain.Select(t => new MiniYamlNode(
|
||||
"TerrainType@{0}".F(t.Value.Type),
|
||||
t.Value.Save())).ToList()));
|
||||
root.Add(new MiniYamlNode("Terrain", null,
|
||||
Terrain.Select(t => new MiniYamlNode("TerrainType@{0}".F(t.Value.Type), t.Value.Save())).ToList()));
|
||||
|
||||
root.Add(new MiniYamlNode("Templates", null,
|
||||
Templates.Select(t => new MiniYamlNode(
|
||||
"Template@{0}".F(t.Value.Id),
|
||||
t.Value.Save())).ToList()));
|
||||
Templates.Select(t => new MiniYamlNode("Template@{0}".F(t.Value.Id), t.Value.Save())).ToList()));
|
||||
root.WriteToFile(filepath);
|
||||
}
|
||||
|
||||
public string GetTerrainType(TileReference<ushort, byte> r)
|
||||
{
|
||||
var tt = Templates[r.type].Tiles;
|
||||
var tt = Templates[r.Type].Tiles;
|
||||
string ret;
|
||||
if (!tt.TryGetValue(r.index, out ret))
|
||||
if (!tt.TryGetValue(r.Index, out ret))
|
||||
return "Clear"; // Default walkable
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user