1
0
Fork 0

Added cByteBuffer::WriteBEUShort().

This commit is contained in:
madmaxoft 2014-09-25 20:46:50 +02:00
parent e751f4ffe3
commit 8f4cc27e39
3 changed files with 15 additions and 1 deletions

View File

@ -547,6 +547,19 @@ bool cByteBuffer::WriteBEShort(short a_Value)
bool cByteBuffer::WriteBEUShort(unsigned short a_Value)
{
CHECK_THREAD;
CheckValid();
PUTBYTES(2);
u_short Converted = htons((u_short)a_Value);
return WriteBuf(&Converted, 2);
}
bool cByteBuffer::WriteBEInt(int a_Value)
{
CHECK_THREAD;

View File

@ -82,6 +82,7 @@ public:
bool WriteChar (char a_Value);
bool WriteByte (unsigned char a_Value);
bool WriteBEShort (short a_Value);
bool WriteBEUShort (unsigned short a_Value);
bool WriteBEInt (int a_Value);
bool WriteBEInt64 (Int64 a_Value);
bool WriteBEFloat (float a_Value);

View File

@ -191,7 +191,7 @@ void cChunkDataSerializer::Serialize47(AString & a_Data, int a_ChunkX, int a_Chu
Packet.WriteBEInt(a_ChunkX);
Packet.WriteBEInt(a_ChunkZ);
Packet.WriteBool(true); // "Ground-up continuous", or rather, "biome data present" flag
Packet.WriteBEShort((short) 0xffff); // We're aways sending the full chunk with no additional data, so the bitmap is 0xffff
Packet.WriteBEUShort(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;