Skip to content

Commit b5d9426

Browse files
Less ugly code
1 parent b616f0a commit b5d9426

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

fCraft/Network/Player.Networking.cs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,18 +1171,13 @@ void WriteWorldData(Map map) {
11711171
Block maxLegal = supportsCustomBlocks ? Map.MaxCustomBlockType : Map.MaxLegalBlockType;
11721172
Logger.Log(LogType.Debug, "Player.JoinWorldNow: Sending compressed map to {0}.", Name);
11731173

1174-
using (LevelChunkStream dst = new LevelChunkStream(this)) {
1175-
Stream compressor = null;
1176-
try {
1177-
compressor = map.CompressMapHeader(this, dst);
1178-
1179-
if (supportsCustomBlocks && supportsBlockDefs) {
1180-
map.CompressMap(dst, compressor);
1181-
} else {
1182-
map.CompressAndConvertMap((byte)maxLegal, dst, compressor);
1183-
}
1184-
} finally {
1185-
if (compressor != null) compressor.Close();
1174+
using (LevelChunkStream dst = new LevelChunkStream(this))
1175+
using (Stream compressor = map.CompressMapHeader(this, dst))
1176+
{
1177+
if (supportsCustomBlocks && supportsBlockDefs) {
1178+
map.CompressMap(dst, compressor);
1179+
} else {
1180+
map.CompressAndConvertMap((byte)maxLegal, dst, compressor);
11861181
}
11871182
}
11881183
}

0 commit comments

Comments
 (0)