summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-09-25 20:46:50 +0200
committermadmaxoft <github@xoft.cz>2014-09-25 20:47:29 +0200
commit8f4cc27e39188d302f6575e7324002e2515fd789 (patch)
tree50069778d50f256b3316c18a18d6203f04909c56
parentMerge pull request #1452 from Howaner/Fixes (diff)
downloadcuberite-8f4cc27e39188d302f6575e7324002e2515fd789.tar
cuberite-8f4cc27e39188d302f6575e7324002e2515fd789.tar.gz
cuberite-8f4cc27e39188d302f6575e7324002e2515fd789.tar.bz2
cuberite-8f4cc27e39188d302f6575e7324002e2515fd789.tar.lz
cuberite-8f4cc27e39188d302f6575e7324002e2515fd789.tar.xz
cuberite-8f4cc27e39188d302f6575e7324002e2515fd789.tar.zst
cuberite-8f4cc27e39188d302f6575e7324002e2515fd789.zip
-rw-r--r--src/ByteBuffer.cpp13
-rw-r--r--src/ByteBuffer.h1
-rw-r--r--src/Protocol/ChunkDataSerializer.cpp2
3 files changed, 15 insertions, 1 deletions
diff --git a/src/ByteBuffer.cpp b/src/ByteBuffer.cpp
index 17e8091c7..5bf98eda9 100644
--- a/src/ByteBuffer.cpp
+++ b/src/ByteBuffer.cpp
@@ -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;
diff --git a/src/ByteBuffer.h b/src/ByteBuffer.h
index c1c71d8c4..74dc378d4 100644
--- a/src/ByteBuffer.h
+++ b/src/ByteBuffer.h
@@ -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);
diff --git a/src/Protocol/ChunkDataSerializer.cpp b/src/Protocol/ChunkDataSerializer.cpp
index a133cc0e3..5d080656d 100644
--- a/src/Protocol/ChunkDataSerializer.cpp
+++ b/src/Protocol/ChunkDataSerializer.cpp
@@ -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;