summaryrefslogtreecommitdiffstats
path: root/src/ChunkBuffer.h
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-05-11 16:52:02 +0200
committerTycho <work.tycho+git@gmail.com>2014-05-11 16:52:02 +0200
commit9278bb732d115251776b12ebb45d0192c7fdd916 (patch)
tree9bf320318f9f31f7198ad7d820f9cad44fdc6963 /src/ChunkBuffer.h
parentCoverage builds are called MCServer not MCServer_debug (diff)
downloadcuberite-9278bb732d115251776b12ebb45d0192c7fdd916.tar
cuberite-9278bb732d115251776b12ebb45d0192c7fdd916.tar.gz
cuberite-9278bb732d115251776b12ebb45d0192c7fdd916.tar.bz2
cuberite-9278bb732d115251776b12ebb45d0192c7fdd916.tar.lz
cuberite-9278bb732d115251776b12ebb45d0192c7fdd916.tar.xz
cuberite-9278bb732d115251776b12ebb45d0192c7fdd916.tar.zst
cuberite-9278bb732d115251776b12ebb45d0192c7fdd916.zip
Diffstat (limited to 'src/ChunkBuffer.h')
-rw-r--r--src/ChunkBuffer.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ChunkBuffer.h b/src/ChunkBuffer.h
index b1bd024d5..e16575bb2 100644
--- a/src/ChunkBuffer.h
+++ b/src/ChunkBuffer.h
@@ -121,12 +121,17 @@ public:
int Section = a_RelY / CHUNK_SECTION_HEIGHT;
if(!m_Sections[Section])
{
+ if(a_Block == 0x00)
+ {
+ return;
+ }
m_Sections[Section] = Allocate();
if(!m_Sections[Section])
{
ASSERT(!"Failed to allocate a new section in Chunkbuffer");
return;
}
+ ZeroSection(m_Sections[Section]);
}
int Index = cChunkDef::MakeIndexNoCheck(a_RelX, a_RelY - (Section * CHUNK_SECTION_HEIGHT), a_RelZ);
m_Sections[Section]->m_BlockTypes[Index] = a_Block;
@@ -166,12 +171,17 @@ public:
int Section = a_RelY / CHUNK_SECTION_HEIGHT;
if(!m_Sections[Section])
{
+ if((a_Nibble & 0xf) == 0x00)
+ {
+ return;
+ }
m_Sections[Section] = Allocate();
if(!m_Sections[Section])
{
ASSERT(!"Failed to allocate a new section in Chunkbuffer");
return;
}
+ ZeroSection(m_Sections[Section]);
}
int Index = cChunkDef::MakeIndexNoCheck(a_RelX, a_RelY - (Section * CHUNK_SECTION_HEIGHT), a_RelZ);
m_Sections[Section]->m_BlockMeta[Index / 2] = static_cast<NIBBLETYPE>(
@@ -247,6 +257,8 @@ private:
sChunkSection * Allocate() const;
void Free(sChunkSection * ptr) const;
+
+ void ZeroSection(sChunkSection * ptr) const;
};