Support custom tile size ingame

This commit is contained in:
Paul Chote
2010-09-15 18:56:48 +12:00
parent ac8a3526a4
commit 051c451867
13 changed files with 149 additions and 130 deletions

View File

@@ -19,16 +19,13 @@ 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( "Expected tile of size {0}x{0}, got {1}x{2]".F(size, Width, Height ) );
throw new InvalidDataException( "{0}x{1} != {2}x{2}".F(Width, Height, size ) );
/*NumTiles = */reader.ReadUInt16();
/*Zero1 = */reader.ReadUInt16();

View File

@@ -74,7 +74,7 @@ namespace OpenRA.FileFormats
public string Name;
public string Id;
public string Palette;
public int TileSize;
public int TileSize = 24;
public string[] Extensions;
public Dictionary<string, TerrainTypeInfo> Terrain = new Dictionary<string, TerrainTypeInfo>();
public Dictionary<ushort, Terrain> Tiles = new Dictionary<ushort, Terrain>();