1
0

fixed assignment bugs and Skylight bug

This commit is contained in:
Tycho 2014-05-17 15:11:58 +01:00
parent 7616895eb3
commit 1f98f21dd1
2 changed files with 6 additions and 4 deletions

View File

@ -76,15 +76,16 @@ public:
} }
#else #else
// unique_ptr style interface for memory management // unique_ptr style interface for memory management
cChunkBuffer(const cChunkBuffer&& other) cChunkBuffer(cChunkBuffer&& other)
{ {
for (int i = 0; i < CHUNK_SECTION_NUM; i++) for (int i = 0; i < CHUNK_SECTION_NUM; i++)
{ {
m_Sections[i] = other.m_Sections[i]; m_Sections[i] = other.m_Sections[i];
other.m_Sections[i] = 0;
} }
} }
cChunkBuffer& operator=(const cChunkBuffer&& other) cChunkBuffer& operator=(cChunkBuffer&& other)
{ {
if(&other != this) if(&other != this)
{ {
@ -92,6 +93,7 @@ public:
{ {
if(m_Sections[i]) Free(m_Sections[i]);; if(m_Sections[i]) Free(m_Sections[i]);;
m_Sections[i] = other.m_Sections[i]; m_Sections[i] = other.m_Sections[i];
other.m_Sections[i] = 0;
} }
} }
return *this; return *this;
@ -230,7 +232,7 @@ public:
} }
else else
{ {
return 0xFF; return 0xF;
} }
} }
ASSERT(!"cChunkBuffer::GetMeta(): coords out of chunk range!"); ASSERT(!"cChunkBuffer::GetMeta(): coords out of chunk range!");

View File

@ -106,7 +106,7 @@ int main(int argc, char** argv)
SrcNibbleBuffer = NULL; SrcNibbleBuffer = NULL;
SrcNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/2]; SrcNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/2];
memset(SrcNibbleBuffer, 0x00, 16 * 16 * 256 /2); memset(SrcNibbleBuffer, 0xFF, 16 * 16 * 256 /2);
buffer.SetSkyLight(SrcNibbleBuffer); buffer.SetSkyLight(SrcNibbleBuffer);
testassert(buffer.GetSkyLight(6,24,1) == 0xF); testassert(buffer.GetSkyLight(6,24,1) == 0xF);
delete SrcNibbleBuffer; delete SrcNibbleBuffer;