diff --git a/src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderReader.cs b/src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderReader.cs index ca3a02d..04c39f2 100644 --- a/src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderReader.cs +++ b/src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderReader.cs @@ -39,15 +39,13 @@ namespace DotRecast.Detour.TileCache.Io header.tx = data.getInt(); header.ty = data.getInt(); header.tlayer = data.getInt(); - for (int j = 0; j < 3; j++) - { - header.bmin[j] = data.getFloat(); - } - - for (int j = 0; j < 3; j++) - { - header.bmax[j] = data.getFloat(); - } + + header.bmin.x = data.getFloat(); + header.bmin.y = data.getFloat(); + header.bmin.z = data.getFloat(); + header.bmax.x = data.getFloat(); + header.bmax.y = data.getFloat(); + header.bmax.z = data.getFloat(); header.hmin = data.getShort() & 0xFFFF; header.hmax = data.getShort() & 0xFFFF; diff --git a/src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderWriter.cs b/src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderWriter.cs index d543da2..3f5fa6d 100644 --- a/src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderWriter.cs +++ b/src/DotRecast.Detour.TileCache/Io/TileCacheLayerHeaderWriter.cs @@ -33,15 +33,13 @@ namespace DotRecast.Detour.TileCache.Io write(stream, header.tx, order); write(stream, header.ty, order); write(stream, header.tlayer, order); - for (int j = 0; j < 3; j++) - { - write(stream, header.bmin[j], order); - } - - for (int j = 0; j < 3; j++) - { - write(stream, header.bmax[j], order); - } + + write(stream, header.bmin.x, order); + write(stream, header.bmin.y, order); + write(stream, header.bmin.z, order); + write(stream, header.bmax.x, order); + write(stream, header.bmax.y, order); + write(stream, header.bmax.z, order); write(stream, (short)header.hmin, order); write(stream, (short)header.hmax, order); diff --git a/src/DotRecast.Detour.TileCache/Io/TileCacheReader.cs b/src/DotRecast.Detour.TileCache/Io/TileCacheReader.cs index 785c915..9f2d3d8 100644 --- a/src/DotRecast.Detour.TileCache/Io/TileCacheReader.cs +++ b/src/DotRecast.Detour.TileCache/Io/TileCacheReader.cs @@ -91,10 +91,10 @@ namespace DotRecast.Detour.TileCache.Io private TileCacheParams readCacheParams(ByteBuffer bb, bool cCompatibility) { TileCacheParams option = new TileCacheParams(); - for (int i = 0; i < 3; i++) - { - option.orig[i] = bb.getFloat(); - } + + option.orig.x = bb.getFloat(); + option.orig.y = bb.getFloat(); + option.orig.z = bb.getFloat(); option.cs = bb.getFloat(); option.ch = bb.getFloat(); diff --git a/src/DotRecast.Detour.TileCache/Io/TileCacheWriter.cs b/src/DotRecast.Detour.TileCache/Io/TileCacheWriter.cs index 3530be8..c71bcea 100644 --- a/src/DotRecast.Detour.TileCache/Io/TileCacheWriter.cs +++ b/src/DotRecast.Detour.TileCache/Io/TileCacheWriter.cs @@ -63,10 +63,9 @@ namespace DotRecast.Detour.TileCache.Io private void writeCacheParams(BinaryWriter stream, TileCacheParams option, ByteOrder order) { - for (int i = 0; i < 3; i++) - { - write(stream, option.orig[i], order); - } + write(stream, option.orig.x, order); + write(stream, option.orig.y, order); + write(stream, option.orig.z, order); write(stream, option.cs, order); write(stream, option.ch, order);