Unified cByteBuffer types.
cByteBuffer now reads and writes any of the [U]Int<N> types.
This commit is contained in:
@@ -188,10 +188,10 @@ void cChunkDataSerializer::Serialize47(AString & a_Data, int a_ChunkX, int a_Chu
|
||||
// Create the packet:
|
||||
cByteBuffer Packet(512 KiB);
|
||||
Packet.WriteVarInt(0x21); // Packet id (Chunk Data packet)
|
||||
Packet.WriteBEInt(a_ChunkX);
|
||||
Packet.WriteBEInt(a_ChunkZ);
|
||||
Packet.WriteBool(true); // "Ground-up continuous", or rather, "biome data present" flag
|
||||
Packet.WriteBEUShort(0xffff); // We're aways sending the full chunk with no additional data, so the bitmap is 0xffff
|
||||
Packet.WriteBEInt32(a_ChunkX);
|
||||
Packet.WriteBEInt32(a_ChunkZ);
|
||||
Packet.WriteBool(true); // "Ground-up continuous", or rather, "biome data present" flag
|
||||
Packet.WriteBEUInt16(0xffff); // We're aways sending the full chunk with no additional data, so the bitmap is 0xffff
|
||||
|
||||
// Write the chunk size:
|
||||
const int BiomeDataSize = cChunkDef::Width * cChunkDef::Width;
|
||||
@@ -208,8 +208,8 @@ void cChunkDataSerializer::Serialize47(AString & a_Data, int a_ChunkX, int a_Chu
|
||||
{
|
||||
BLOCKTYPE BlockType = m_BlockTypes[Index] & 0xFF;
|
||||
NIBBLETYPE BlockMeta = m_BlockMetas[Index / 2] >> ((Index & 1) * 4) & 0x0f;
|
||||
Packet.WriteByte((unsigned char)(BlockType << 4) | BlockMeta);
|
||||
Packet.WriteByte((unsigned char)(BlockType >> 4));
|
||||
Packet.WriteBEUInt8(static_cast<unsigned char>(BlockType << 4) | BlockMeta);
|
||||
Packet.WriteBEUInt8(static_cast<unsigned char>(BlockType >> 4));
|
||||
}
|
||||
|
||||
// Write the rest:
|
||||
|
||||
Reference in New Issue
Block a user