private static ITile[,] ReadTiles(BinaryReader br, int w, int h) { ITile[,] tiles = new ITile[w, h]; for (int x = 0; x < w; x++) { for (int y = 0; y < h; y++) { ITile tile = ReadTile(br, out int count); tiles[x, y] = tile; while (count > 0) { tiles[x, ++y] = (ITile)tile.Clone(); count--; } } } return(tiles); }