summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-05-21 22:46:20 +0200
committerTycho <work.tycho+git@gmail.com>2014-05-21 22:46:20 +0200
commit4b23472097fa2daee464b6c5d73da56a0706731c (patch)
tree1d89afa64602ffe186b811e141d80df9dd8ad448 /src
parentFixed reversed comparisons to null (diff)
downloadcuberite-4b23472097fa2daee464b6c5d73da56a0706731c.tar
cuberite-4b23472097fa2daee464b6c5d73da56a0706731c.tar.gz
cuberite-4b23472097fa2daee464b6c5d73da56a0706731c.tar.bz2
cuberite-4b23472097fa2daee464b6c5d73da56a0706731c.tar.lz
cuberite-4b23472097fa2daee464b6c5d73da56a0706731c.tar.xz
cuberite-4b23472097fa2daee464b6c5d73da56a0706731c.tar.zst
cuberite-4b23472097fa2daee464b6c5d73da56a0706731c.zip
Diffstat (limited to '')
-rw-r--r--src/ChunkData.cpp13
-rw-r--r--src/ChunkData.h32
2 files changed, 23 insertions, 22 deletions
diff --git a/src/ChunkData.cpp b/src/ChunkData.cpp
index 0cacaf02d..86b0c431c 100644
--- a/src/ChunkData.cpp
+++ b/src/ChunkData.cpp
@@ -7,7 +7,7 @@ cChunkData cChunkData::Copy() const
cChunkData copy;
for (int i = 0; i < CHUNK_SECTION_NUM; i++)
{
- if(m_Sections[i] != NULL)
+ if (m_Sections[i] != NULL)
{
copy.m_Sections[i] = Allocate();
*copy.m_Sections[i] = *m_Sections[i];
@@ -30,7 +30,7 @@ void cChunkData::CopyBlocks (BLOCKTYPE * a_dest, size_t a_Idx, size_t length)
{
size_t tocopy = length > segment_length ? segment_length : length;
length -= tocopy;
- if(m_Sections[i] != NULL)
+ if (m_Sections[i] != NULL)
{
memcpy(
&a_dest[i * segment_length],
@@ -59,12 +59,13 @@ void cChunkData::CopyMeta(NIBBLETYPE * a_dest) const
for (size_t i = 0; i < CHUNK_SECTION_NUM; i++)
{
const size_t segment_length = CHUNK_SECTION_HEIGHT * 16 * 16 / 2;
- if(m_Sections[i] != NULL)
+ if (m_Sections[i] != NULL)
{
memcpy(
&a_dest[i * segment_length],
&m_Sections[i]->m_BlockMeta,
- sizeof(NIBBLETYPE) * segment_length);
+ sizeof(NIBBLETYPE) * segment_length
+ );
}
else
{
@@ -86,7 +87,7 @@ void cChunkData::CopyLight(NIBBLETYPE * a_dest) const
for (size_t i = 0; i < CHUNK_SECTION_NUM; i++)
{
const size_t segment_length = CHUNK_SECTION_HEIGHT * 16 * 16 / 2;
- if(m_Sections[i] != NULL)
+ if (m_Sections[i] != NULL)
{
memcpy(
&a_dest[i * segment_length],
@@ -114,7 +115,7 @@ void cChunkData::CopySkyLight(NIBBLETYPE * a_dest) const
for (size_t i = 0; i < CHUNK_SECTION_NUM; i++)
{
const size_t segment_length = CHUNK_SECTION_HEIGHT * 16 * 16 / 2;
- if(m_Sections[i] != NULL)
+ if (m_Sections[i] != NULL)
{
memcpy(
&a_dest[i * segment_length],
diff --git a/src/ChunkData.h b/src/ChunkData.h
index 51244225b..9c852ee24 100644
--- a/src/ChunkData.h
+++ b/src/ChunkData.h
@@ -33,11 +33,11 @@ public:
{
#if __cplusplus < 201103L
// auto_ptr style interface for memory management
- if(!IsOwner) return;
+ if (!IsOwner) return;
#endif
for (int i = 0; i < CHUNK_SECTION_NUM; i++)
{
- if(m_Sections[i] == NULL) Free(m_Sections[i]);;
+ if (m_Sections[i] == NULL) Free(m_Sections[i]);;
}
}
@@ -55,13 +55,13 @@ public:
cChunkData& operator=(const cChunkData& other)
{
- if(&other != this)
+ if (&other != this)
{
- if(IsOwner)
+ if (IsOwner)
{
for (int i = 0; i < CHUNK_SECTION_NUM; i++)
{
- if(m_Sections[i]) Free(m_Sections[i]);;
+ if (m_Sections[i]) Free(m_Sections[i]);;
}
}
IsOwner = true;
@@ -87,7 +87,7 @@ public:
cChunkData& operator=(cChunkData&& other)
{
- if(&other != this)
+ if (&other != this)
{
for (int i = 0; i < CHUNK_SECTION_NUM; i++)
{
@@ -106,7 +106,7 @@ public:
ASSERT((a_Y >= 0) && (a_Y < cChunkDef::Height));
ASSERT((a_Z >= 0) && (a_Z < cChunkDef::Width));
int Section = a_Y / CHUNK_SECTION_HEIGHT;
- if(m_Sections[Section] != NULL)
+ if (m_Sections[Section] != NULL)
{
int Index = cChunkDef::MakeIndexNoCheck(a_X, a_Y - (Section * CHUNK_SECTION_HEIGHT), a_Z);
return m_Sections[Section]->m_BlockTypes[Index];
@@ -130,14 +130,14 @@ public:
}
int Section = a_RelY / CHUNK_SECTION_HEIGHT;
- if(m_Sections[Section] == NULL)
+ if (m_Sections[Section] == NULL)
{
- if(a_Block == 0x00)
+ if (a_Block == 0x00)
{
return;
}
m_Sections[Section] = Allocate();
- if(m_Sections[Section] == NULL)
+ if (m_Sections[Section] == NULL)
{
ASSERT(!"Failed to allocate a new section in Chunkbuffer");
return;
@@ -153,7 +153,7 @@ public:
if ((a_RelX < cChunkDef::Width) && (a_RelX > -1) && (a_RelY < cChunkDef::Height) && (a_RelY > -1) && (a_RelZ < cChunkDef::Width) && (a_RelZ > -1))
{
int Section = a_RelY / CHUNK_SECTION_HEIGHT;
- if(m_Sections[Section] != NULL)
+ if (m_Sections[Section] != NULL)
{
int Index = cChunkDef::MakeIndexNoCheck(a_RelX, a_RelY - (Section * CHUNK_SECTION_HEIGHT), a_RelZ);
return (m_Sections[Section]->m_BlockMeta[Index / 2] >> ((Index & 1) * 4)) & 0x0f;
@@ -180,14 +180,14 @@ public:
}
int Section = a_RelY / CHUNK_SECTION_HEIGHT;
- if(m_Sections[Section] == NULL)
+ if (m_Sections[Section] == NULL)
{
- if((a_Nibble & 0xf) == 0x00)
+ if ((a_Nibble & 0xf) == 0x00)
{
return false;
}
m_Sections[Section] = Allocate();
- if(m_Sections[Section] == NULL)
+ if (m_Sections[Section] == NULL)
{
ASSERT(!"Failed to allocate a new section in Chunkbuffer");
return false;
@@ -208,7 +208,7 @@ public:
if ((a_RelX < cChunkDef::Width) && (a_RelX > -1) && (a_RelY < cChunkDef::Height) && (a_RelY > -1) && (a_RelZ < cChunkDef::Width) && (a_RelZ > -1))
{
int Section = a_RelY / CHUNK_SECTION_HEIGHT;
- if(m_Sections[Section] != NULL)
+ if (m_Sections[Section] != NULL)
{
int Index = cChunkDef::MakeIndexNoCheck(a_RelX, a_RelY - (Section * CHUNK_SECTION_HEIGHT), a_RelZ);
return (m_Sections[Section]->m_BlockLight[Index / 2] >> ((Index & 1) * 4)) & 0x0f;
@@ -227,7 +227,7 @@ public:
if ((a_RelX < cChunkDef::Width) && (a_RelX > -1) && (a_RelY < cChunkDef::Height) && (a_RelY > -1) && (a_RelZ < cChunkDef::Width) && (a_RelZ > -1))
{
int Section = a_RelY / CHUNK_SECTION_HEIGHT;
- if(m_Sections[Section] != NULL)
+ if (m_Sections[Section] != NULL)
{
int Index = cChunkDef::MakeIndexNoCheck(a_RelX, a_RelY - (Section * CHUNK_SECTION_HEIGHT), a_RelZ);
return (m_Sections[Section]->m_BlockLight[Index / 2] >> ((Index & 1) * 4)) & 0x0f;