summaryrefslogtreecommitdiffstats
path: root/src/Protocol/ChunkDataSerializer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Protocol/ChunkDataSerializer.h')
-rw-r--r--src/Protocol/ChunkDataSerializer.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Protocol/ChunkDataSerializer.h b/src/Protocol/ChunkDataSerializer.h
index aeff7c356..ea0b0be11 100644
--- a/src/Protocol/ChunkDataSerializer.h
+++ b/src/Protocol/ChunkDataSerializer.h
@@ -3,6 +3,8 @@
#include "../ByteBuffer.h"
#include "../ChunkData.h"
#include "../Defines.h"
+#include "CircularBufferCompressor.h"
+#include "StringCompression.h"
@@ -37,8 +39,7 @@ class cChunkDataSerializer
/** A single cache entry containing the raw data, compressed data, and a validity flag. */
struct ChunkDataCache
{
- std::string PacketData;
- std::string ToSend;
+ ContiguousByteBuffer ToSend;
bool Engaged = false;
};
@@ -50,7 +51,7 @@ public:
Parameters are the coordinates of the chunk to serialise, and the data and biome data read from the chunk. */
void SendToClients(int a_ChunkX, int a_ChunkZ, const cChunkData & a_Data, const unsigned char * a_BiomeData, const ClientHandles & a_SendTo);
-protected:
+private:
/** Serialises the given chunk, storing the result into the given cache entry, and sends the data.
If the cache entry is already present, simply re-uses it. */
@@ -74,6 +75,9 @@ protected:
/** A staging area used to construct the chunk packet, persistent to avoid reallocating. */
cByteBuffer m_Packet;
+ /** A compressor used to compress the chunk data. */
+ CircularBufferCompressor m_Compressor;
+
/** The dimension for the World this Serializer is tied to. */
const eDimension m_Dimension;
@@ -81,7 +85,3 @@ protected:
It is used during a single invocation of SendToClients with more than one client. */
std::array<ChunkDataCache, static_cast<size_t>(CacheVersion::Last) + 1> m_Cache;
} ;
-
-
-
-