add chunkCount to 0x38

changed some more things for more API consistency

 * 0x33: compressedData -> compressedChunkData
 * 0x38: meta.chunkX -> meta.x
 * 0x38: meta.chunkZ -> meta.z
 * 0x38: meta.primaryBitMap -> meta.bitMap
 * 0x38: add chunkCount
This commit is contained in:
Andrew Kelley 2013-01-05 16:51:42 -05:00
parent 37d1cdcca1
commit 08f71f11dc

View file

@ -264,7 +264,7 @@ var packets = {
{ name: "groundUp", type: "bool" }, { name: "groundUp", type: "bool" },
{ name: "bitMap", type: "ushort" }, { name: "bitMap", type: "ushort" },
{ name: "addBitMap", type: "ushort" }, { name: "addBitMap", type: "ushort" },
{ name: "compressedData", type: "byteArray32" } { name: "compressedChunkData", type: "byteArray32" }
], ],
0x34: [ 0x34: [
{ name: "chunkX", type: "int" }, { name: "chunkX", type: "int" },
@ -635,21 +635,21 @@ function readMapChunkBulk (buffer, offset) {
cursor = compressedChunkDataEnd; cursor = compressedChunkDataEnd;
var meta = []; var meta = [];
var i, chunkX, chunkZ, primaryBitMap, addBitMap; var i, chunkX, chunkZ, bitMap, addBitMap;
for (i = 0; i < chunkCount; ++i) { for (i = 0; i < chunkCount; ++i) {
chunkX = buffer.readInt32BE(cursor); chunkX = buffer.readInt32BE(cursor);
cursor += 4; cursor += 4;
chunkZ = buffer.readInt32BE(cursor); chunkZ = buffer.readInt32BE(cursor);
cursor += 4; cursor += 4;
primaryBitMap = buffer.readUInt16BE(cursor); bitMap = buffer.readUInt16BE(cursor);
cursor += 2; cursor += 2;
addBitMap = buffer.readUInt16BE(cursor); addBitMap = buffer.readUInt16BE(cursor);
cursor += 2; cursor += 2;
meta.push({ meta.push({
chunkX: chunkX, x: chunkX,
chunkZ: chunkZ, z: chunkZ,
primaryBitMap: primaryBitMap, bitMap: bitMap,
addBitMap: addBitMap, addBitMap: addBitMap,
}); });
} }
@ -657,6 +657,7 @@ function readMapChunkBulk (buffer, offset) {
return { return {
value: { value: {
skyLightSent: skyLightSent, skyLightSent: skyLightSent,
chunkCount: chunkCount,
compressedChunkData: compressedChunkData, compressedChunkData: compressedChunkData,
meta: meta, meta: meta,
}, },