diff --git a/OpenRa.FileFormats/Map.cs b/OpenRa.FileFormats/Map.cs index 2eae760d1a..d5e77e0992 100644 --- a/OpenRa.FileFormats/Map.cs +++ b/OpenRa.FileFormats/Map.cs @@ -43,14 +43,12 @@ namespace OpenRa.FileFormats Width = int.Parse(map.GetValue("Width", "0")); Height = int.Parse(map.GetValue("Height", "0")); - UnpackTileData(ReadMapPack(file)); + UnpackTileData( ReadPackedSection( file.GetSection( "MapPack" ) ) ); ReadTrees(file); } - static MemoryStream ReadMapPack(IniFile file) + static MemoryStream ReadPackedSection(IniSection mapPackSection) { - IniSection mapPackSection = file.GetSection("MapPack"); - StringBuilder sb = new StringBuilder(); for (int i = 1; ; i++) { @@ -120,6 +118,14 @@ namespace OpenRa.FileFormats } } + void UnpackOverlayData( MemoryStream ms ) + { + for( int i = 0 ; i < 128 ; i++ ) + for( int j = 0 ; j < 128 ; j++ ) + MapTiles[ j, i ].overlay = ReadByte( ms ); + + } + void ReadTrees( IniFile file ) { IniSection terrain = file.GetSection( "TERRAIN" ); diff --git a/OpenRa.FileFormats/TileReference.cs b/OpenRa.FileFormats/TileReference.cs index 836f3173c9..15698becfa 100644 --- a/OpenRa.FileFormats/TileReference.cs +++ b/OpenRa.FileFormats/TileReference.cs @@ -8,19 +8,20 @@ namespace OpenRa.FileFormats { public ushort tile; public byte image; + public byte overlay; public override int GetHashCode() { return tile.GetHashCode() ^ image.GetHashCode(); } - public override bool Equals(object obj) + public override bool Equals( object obj ) { - if (obj == null) + if( obj == null ) return false; TileReference r = (TileReference)obj; - return (r.image == image && r.tile == tile); + return ( r.image == image && r.tile == tile ); } - public static bool operator ==(TileReference a, TileReference b) { return a.Equals(b); } - public static bool operator !=(TileReference a, TileReference b) { return !a.Equals(b); } + public static bool operator ==( TileReference a, TileReference b ) { return a.Equals( b ); } + public static bool operator !=( TileReference a, TileReference b ) { return !a.Equals( b ); } } }