From a473e8ba52243a1a2a4f3aac840ed884d994fb0b Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 21 Aug 2020 18:22:04 +0100 Subject: ChunkDataSerializer: don't repeatedly mallocate + Store an instance of the class, the way it seems it is meant to be used. --- src/ChunkSender.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/ChunkSender.h') diff --git a/src/ChunkSender.h b/src/ChunkSender.h index 7caf9424e..2d9c478e9 100644 --- a/src/ChunkSender.h +++ b/src/ChunkSender.h @@ -27,6 +27,7 @@ Note that it may be called by world's BroadcastToChunk() if the client is still #include "OSSupport/IsThread.h" #include "ChunkDataCallback.h" +#include "Protocol/ChunkDataSerializer.h" @@ -109,6 +110,9 @@ protected: cWorld & m_World; + /** An instance of a chunk serializer, held to maintain its internal cache. */ + cChunkDataSerializer m_Serializer; + cCriticalSection m_CS; std::priority_queue m_SendChunks; std::unordered_map m_ChunkInfo; -- cgit v1.2.3