diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2021-03-05 14:03:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-05 14:03:55 +0100 |
commit | 868cd94ee9a5a0638c014a4cc42224f01ff234c8 (patch) | |
tree | cd23dc866f77de5b0b3e89a5eafeeb2ef24ffbdd /src/LightingThread.cpp | |
parent | fixed the crash on generating in the SinglePiceStructuresGen (#5136) (diff) | |
download | cuberite-868cd94ee9a5a0638c014a4cc42224f01ff234c8.tar cuberite-868cd94ee9a5a0638c014a4cc42224f01ff234c8.tar.gz cuberite-868cd94ee9a5a0638c014a4cc42224f01ff234c8.tar.bz2 cuberite-868cd94ee9a5a0638c014a4cc42224f01ff234c8.tar.lz cuberite-868cd94ee9a5a0638c014a4cc42224f01ff234c8.tar.xz cuberite-868cd94ee9a5a0638c014a4cc42224f01ff234c8.tar.zst cuberite-868cd94ee9a5a0638c014a4cc42224f01ff234c8.zip |
Diffstat (limited to '')
-rw-r--r-- | src/LightingThread.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/LightingThread.cpp b/src/LightingThread.cpp index 0632bbd23..015bfb68a 100644 --- a/src/LightingThread.cpp +++ b/src/LightingThread.cpp @@ -17,25 +17,25 @@ class cReader : public cChunkDataCallback { - virtual void ChunkData(const cChunkData & a_ChunkBuffer) override + virtual void ChunkData(const ChunkBlockData & a_BlockData, const ChunkLightData &) override { BLOCKTYPE * OutputRows = m_BlockTypes; int OutputIdx = m_ReadingChunkX + m_ReadingChunkZ * cChunkDef::Width * 3; - for (size_t i = 0; i != cChunkData::NumSections; ++i) + for (size_t i = 0; i != cChunkDef::NumSections; ++i) { - auto * Section = a_ChunkBuffer.GetSection(i); + const auto Section = a_BlockData.GetSection(i); if (Section == nullptr) { // Skip to the next section - OutputIdx += 9 * cChunkData::SectionHeight * cChunkDef::Width; + OutputIdx += 9 * cChunkDef::SectionHeight * cChunkDef::Width; continue; } - for (size_t OffsetY = 0; OffsetY != cChunkData::SectionHeight; ++OffsetY) + for (size_t OffsetY = 0; OffsetY != cChunkDef::SectionHeight; ++OffsetY) { for (size_t Z = 0; Z != cChunkDef::Width; ++Z) { - auto InPtr = Section->m_BlockTypes + Z * cChunkDef::Width + OffsetY * cChunkDef::Width * cChunkDef::Width; + auto InPtr = Section->data() + Z * cChunkDef::Width + OffsetY * cChunkDef::Width * cChunkDef::Width; std::copy_n(InPtr, cChunkDef::Width, OutputRows + OutputIdx * cChunkDef::Width); OutputIdx += 3; @@ -48,7 +48,7 @@ class cReader : } // BlockTypes() - virtual void HeightMap(const cChunkDef::HeightMap * a_Heightmap) override + virtual void HeightMap(const cChunkDef::HeightMap & a_Heightmap) override { // Copy the entire heightmap, distribute it into the 3x3 chunk blob: typedef struct {HEIGHTTYPE m_Row[16]; } ROW; @@ -64,11 +64,11 @@ class cReader : // Find the highest block in the entire chunk, use it as a base for m_MaxHeight: HEIGHTTYPE MaxHeight = m_MaxHeight; - for (size_t i = 0; i < ARRAYCOUNT(*a_Heightmap); i++) + for (size_t i = 0; i < ARRAYCOUNT(a_Heightmap); i++) { - if ((*a_Heightmap)[i] > MaxHeight) + if (a_Heightmap[i] > MaxHeight) { - MaxHeight = (*a_Heightmap)[i]; + MaxHeight = a_Heightmap[i]; } } m_MaxHeight = MaxHeight; |