diff --git a/OpenRA.FileFormats/Map/Terrain.cs b/OpenRA.FileFormats/Map/Terrain.cs index c431b69701..f39c33cc75 100644 --- a/OpenRA.FileFormats/Map/Terrain.cs +++ b/OpenRA.FileFormats/Map/Terrain.cs @@ -19,13 +19,16 @@ namespace OpenRA.FileFormats public Terrain( Stream stream, int size ) { + System.Console.WriteLine("Loading tile with expected size {0}",size); // Try loading as a cnc .tem BinaryReader reader = new BinaryReader( stream ); int Width = reader.ReadUInt16(); int Height = reader.ReadUInt16(); + System.Console.WriteLine("Actual size {0}x{1}",Width,Height); + if( Width != size || Height != size ) - throw new InvalidDataException( string.Format( "Expected tile of size {0}x{1}, got {1}x{2]", size, size, Width, Height ) ); + throw new InvalidDataException( "Expected tile of size {0}x{0}, got {1}x{2]".F(size, Width, Height ) ); /*NumTiles = */reader.ReadUInt16(); /*Zero1 = */reader.ReadUInt16(); diff --git a/OpenRA.FileFormats/Map/TileSet.cs b/OpenRA.FileFormats/Map/TileSet.cs index a356d44bff..46e57d1b2a 100644 --- a/OpenRA.FileFormats/Map/TileSet.cs +++ b/OpenRA.FileFormats/Map/TileSet.cs @@ -74,7 +74,7 @@ namespace OpenRA.FileFormats public string Name; public string Id; public string Palette; - public int TileSize = 24; + public int TileSize; public string[] Extensions; public Dictionary Terrain = new Dictionary(); public Dictionary Tiles = new Dictionary(); @@ -111,13 +111,6 @@ namespace OpenRA.FileFormats public void Save(string filepath) { var root = new List(); - foreach (var field in fields) - { - FieldInfo f = this.GetType().GetField(field); - if (f.GetValue(this) == null) continue; - root.Add( new MiniYamlNode( field, FieldSaver.FormatValue( this, f ) ) ); - } - var gen = new List(); foreach (var field in fields) { diff --git a/OpenRA.TilesetBuilder/Form1.cs b/OpenRA.TilesetBuilder/Form1.cs index 4b8ed60c49..c249f33d78 100644 --- a/OpenRA.TilesetBuilder/Form1.cs +++ b/OpenRA.TilesetBuilder/Form1.cs @@ -23,14 +23,13 @@ namespace OpenRA.TilesetBuilder public partial class Form1 : Form { string srcfile; - int TileSize; + int size; public Form1( string src, int size ) { srcfile = src; - TileSize = size; + this.size = size; InitializeComponent(); - - surface1.TileSize = TileSize; + surface1.TileSize = size; surface1.Image = (Bitmap)Image.FromFile(src); surface1.TerrainTypes = new int[surface1.Image.Width / size, surface1.Image.Height / size]; /* all passable by default */ surface1.Templates = new List