diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2021-01-11 17:39:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-11 17:39:43 +0100 |
commit | eeb63b8901a9c049f1bb594abb9ce9b4a9c47620 (patch) | |
tree | b07daae788f918b83eeb0bdbd51e49292f1c8d88 /src/Protocol/ChunkDataSerializer.h | |
parent | Fixed switch-ups regarding some slab and stair recipes (#5099) (diff) | |
download | cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar.gz cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar.bz2 cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar.lz cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar.xz cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar.zst cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.zip |
Diffstat (limited to 'src/Protocol/ChunkDataSerializer.h')
-rw-r--r-- | src/Protocol/ChunkDataSerializer.h | 14 |
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; } ; - - - - |