From 868cd94ee9a5a0638c014a4cc42224f01ff234c8 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 5 Mar 2021 13:03:55 +0000 Subject: Prepare ChunkData for BlockState storage (#5105) * Rename ChunkData Creatable test * Add missing Y-check in RedstoneWireHandler * Remove ChunkDef.h dependency in Scoreboard * Prepare ChunkData for BlockState storage + Split chunk block, meta, block & sky light storage + Load the height map from disk - Reduce duplicated code in ChunkData - Remove saving MCSBiomes, there aren't any - Remove the allocation pool, ref #4315, #3864 * fixed build * fixed test * fixed the debug compile Co-authored-by: 12xx12 <44411062+12xx12@users.noreply.github.com> --- src/ChunkSender.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/ChunkSender.cpp') diff --git a/src/ChunkSender.cpp b/src/ChunkSender.cpp index 0a7f58bc7..e40714472 100644 --- a/src/ChunkSender.cpp +++ b/src/ChunkSender.cpp @@ -238,7 +238,7 @@ void cChunkSender::SendChunk(int a_ChunkX, int a_ChunkZ, const WeakClients & a_C } // Send: - m_Serializer.SendToClients(a_ChunkX, a_ChunkZ, m_Data, m_BiomeMap, Clients); + m_Serializer.SendToClients(a_ChunkX, a_ChunkZ, m_BlockData, m_LightData, m_BiomeMap, Clients); for (const auto & Client : Clients) { @@ -276,7 +276,7 @@ void cChunkSender::SendChunk(int a_ChunkX, int a_ChunkZ, const WeakClients & a_C }); } } - m_Data.Clear(); + m_BlockEntities.clear(); m_EntityIDs.clear(); } @@ -303,14 +303,14 @@ void cChunkSender::Entity(cEntity * a_Entity) -void cChunkSender::BiomeData(const cChunkDef::BiomeMap * a_BiomeMap) +void cChunkSender::BiomeMap(const cChunkDef::BiomeMap & a_BiomeMap) { for (size_t i = 0; i < ARRAYCOUNT(m_BiomeMap); i++) { - if ((*a_BiomeMap)[i] < 255) + if (a_BiomeMap[i] < 255) { // Normal MC biome, copy as-is: - m_BiomeMap[i] = static_cast((*a_BiomeMap)[i]); + m_BiomeMap[i] = static_cast(a_BiomeMap[i]); } else { @@ -319,7 +319,3 @@ void cChunkSender::BiomeData(const cChunkDef::BiomeMap * a_BiomeMap) } } // for i - m_BiomeMap[] } - - - - -- cgit v1.2.3