summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-05-17 16:11:58 +0200
committerTycho <work.tycho+git@gmail.com>2014-05-17 16:11:58 +0200
commit1f98f21dd1c1664102dfb480a69c8d1901c3ae5f (patch)
tree7c4b7be42f323cac18d45b5f551463fccb8c2ef2
parentFix assignment operators test (diff)
downloadcuberite-1f98f21dd1c1664102dfb480a69c8d1901c3ae5f.tar
cuberite-1f98f21dd1c1664102dfb480a69c8d1901c3ae5f.tar.gz
cuberite-1f98f21dd1c1664102dfb480a69c8d1901c3ae5f.tar.bz2
cuberite-1f98f21dd1c1664102dfb480a69c8d1901c3ae5f.tar.lz
cuberite-1f98f21dd1c1664102dfb480a69c8d1901c3ae5f.tar.xz
cuberite-1f98f21dd1c1664102dfb480a69c8d1901c3ae5f.tar.zst
cuberite-1f98f21dd1c1664102dfb480a69c8d1901c3ae5f.zip
-rw-r--r--src/ChunkBuffer.h8
-rw-r--r--tests/ChunkBuffer/ArraytoCoord.cpp2
2 files changed, 6 insertions, 4 deletions
diff --git a/src/ChunkBuffer.h b/src/ChunkBuffer.h
index 66edce867..4086c4ae9 100644
--- a/src/ChunkBuffer.h
+++ b/src/ChunkBuffer.h
@@ -76,15 +76,16 @@ public:
}
#else
// unique_ptr style interface for memory management
- cChunkBuffer(const cChunkBuffer&& other)
+ cChunkBuffer(cChunkBuffer&& other)
{
for (int i = 0; i < CHUNK_SECTION_NUM; 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)
{
@@ -92,6 +93,7 @@ public:
{
if(m_Sections[i]) Free(m_Sections[i]);;
m_Sections[i] = other.m_Sections[i];
+ other.m_Sections[i] = 0;
}
}
return *this;
@@ -230,7 +232,7 @@ public:
}
else
{
- return 0xFF;
+ return 0xF;
}
}
ASSERT(!"cChunkBuffer::GetMeta(): coords out of chunk range!");
diff --git a/tests/ChunkBuffer/ArraytoCoord.cpp b/tests/ChunkBuffer/ArraytoCoord.cpp
index 993dc6cc5..5563a3f86 100644
--- a/tests/ChunkBuffer/ArraytoCoord.cpp
+++ b/tests/ChunkBuffer/ArraytoCoord.cpp
@@ -106,7 +106,7 @@ int main(int argc, char** argv)
SrcNibbleBuffer = NULL;
SrcNibbleBuffer = new NIBBLETYPE[16 * 16 * 256/2];
- memset(SrcNibbleBuffer, 0x00, 16 * 16 * 256 /2);
+ memset(SrcNibbleBuffer, 0xFF, 16 * 16 * 256 /2);
buffer.SetSkyLight(SrcNibbleBuffer);
testassert(buffer.GetSkyLight(6,24,1) == 0xF);
delete SrcNibbleBuffer;