summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-05-21 20:58:48 +0200
committerTycho <work.tycho+git@gmail.com>2014-05-21 20:58:48 +0200
commit024027db89ca833406147b79b7be74fc92906bbe (patch)
tree844345e33c2a9c8fb7f5ca255f0bd1236a41b446 /src
parentFixed minor style issues (diff)
downloadcuberite-024027db89ca833406147b79b7be74fc92906bbe.tar
cuberite-024027db89ca833406147b79b7be74fc92906bbe.tar.gz
cuberite-024027db89ca833406147b79b7be74fc92906bbe.tar.bz2
cuberite-024027db89ca833406147b79b7be74fc92906bbe.tar.lz
cuberite-024027db89ca833406147b79b7be74fc92906bbe.tar.xz
cuberite-024027db89ca833406147b79b7be74fc92906bbe.tar.zst
cuberite-024027db89ca833406147b79b7be74fc92906bbe.zip
Diffstat (limited to '')
-rw-r--r--src/BlockArea.cpp4
-rw-r--r--src/BlockArea.h2
-rw-r--r--src/Chunk.cpp38
-rw-r--r--src/Chunk.h12
-rw-r--r--src/ChunkData.cpp (renamed from src/ChunkBuffer.cpp)30
-rw-r--r--src/ChunkData.h (renamed from src/ChunkBuffer.h)26
-rw-r--r--src/ChunkDataCallback.h18
-rw-r--r--src/LightingThread.cpp2
-rw-r--r--src/WorldStorage/WSSCompact.h2
9 files changed, 67 insertions, 67 deletions
diff --git a/src/BlockArea.cpp b/src/BlockArea.cpp
index 5e41b135c..0c46e59e5 100644
--- a/src/BlockArea.cpp
+++ b/src/BlockArea.cpp
@@ -9,7 +9,7 @@
#include "OSSupport/GZipFile.h"
#include "Blocks/BlockHandler.h"
#include "Cuboid.h"
-#include "ChunkBuffer.h"
+#include "ChunkData.h"
@@ -1835,7 +1835,7 @@ bool cBlockArea::cChunkReader::Coords(int a_ChunkX, int a_ChunkZ)
-void cBlockArea::cChunkReader::ChunkBuffer(const cChunkBuffer & a_BlockBuffer)
+void cBlockArea::cChunkReader::ChunkData(const cChunkData & a_BlockBuffer)
{
{
if (!(m_Area.m_BlockTypes == NULL))
diff --git a/src/BlockArea.h b/src/BlockArea.h
index 6b3bdf337..2bd26facd 100644
--- a/src/BlockArea.h
+++ b/src/BlockArea.h
@@ -318,7 +318,7 @@ protected:
// cChunkDataCallback overrides:
virtual bool Coords(int a_ChunkX, int a_ChunkZ) override;
- virtual void ChunkBuffer(const cChunkBuffer & a_BlockTypes) override;
+ virtual void ChunkData(const cChunkData & a_BlockTypes) override;
} ;
typedef NIBBLETYPE * NIBBLEARRAY;
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 00ea33e16..a45ed32c1 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -238,12 +238,12 @@ void cChunk::MarkLoadFailed(void)
void cChunk::GetAllData(cChunkDataCallback & a_Callback)
{
- a_Callback.HeightMap (&m_HeightMap);
- a_Callback.BiomeData (&m_BiomeMap);
+ a_Callback.HeightMap(&m_HeightMap);
+ a_Callback.BiomeData(&m_BiomeMap);
- a_Callback.LightIsValid (m_IsLightValid);
+ a_Callback.LightIsValid(m_IsLightValid);
- a_Callback.ChunkBuffer (m_ChunkBuffer);
+ a_Callback.ChunkData(m_ChunkData);
for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr)
{
@@ -282,10 +282,10 @@ void cChunk::SetAllData(
CalculateHeightmap(a_BlockTypes);
}
- m_ChunkBuffer.SetBlocks(a_BlockTypes);
- m_ChunkBuffer.SetMeta(a_BlockMeta);
- m_ChunkBuffer.SetLight(a_BlockLight);
- m_ChunkBuffer.SetSkyLight(a_BlockSkyLight);
+ m_ChunkData.SetBlocks(a_BlockTypes);
+ m_ChunkData.SetMeta(a_BlockMeta);
+ m_ChunkData.SetLight(a_BlockLight);
+ m_ChunkData.SetSkyLight(a_BlockSkyLight);
m_IsLightValid = (a_BlockLight != NULL) && (a_BlockSkyLight != NULL);
@@ -326,9 +326,9 @@ void cChunk::SetLight(
// TODO: We might get cases of wrong lighting when a chunk changes in the middle of a lighting calculation.
// Postponing until we see how bad it is :)
- m_ChunkBuffer.SetLight (a_BlockLight);
+ m_ChunkData.SetLight (a_BlockLight);
- m_ChunkBuffer.SetSkyLight (a_SkyLight);
+ m_ChunkData.SetSkyLight (a_SkyLight);
m_IsLightValid = true;
}
@@ -339,7 +339,7 @@ void cChunk::SetLight(
void cChunk::GetBlockTypes(BLOCKTYPE * a_BlockTypes)
{
- m_ChunkBuffer.CopyBlocks(a_BlockTypes);
+ m_ChunkData.CopyBlocks(a_BlockTypes);
}
@@ -1507,7 +1507,7 @@ void cChunk::FastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockT
ASSERT(IsValid());
const BLOCKTYPE OldBlockType = GetBlock(a_RelX, a_RelY, a_RelZ);
- const BLOCKTYPE OldBlockMeta = m_ChunkBuffer.GetMeta(a_RelX, a_RelY, a_RelZ);
+ const BLOCKTYPE OldBlockMeta = m_ChunkData.GetMeta(a_RelX, a_RelY, a_RelZ);
if ((OldBlockType == a_BlockType) && (OldBlockMeta == a_BlockMeta))
{
return;
@@ -1515,7 +1515,7 @@ void cChunk::FastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockT
MarkDirty();
- m_ChunkBuffer.SetBlock(a_RelX, a_RelY, a_RelZ, a_BlockType);
+ m_ChunkData.SetBlock(a_RelX, a_RelY, a_RelZ, a_BlockType);
// The client doesn't need to distinguish between stationary and nonstationary fluids:
if (
@@ -1531,7 +1531,7 @@ void cChunk::FastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockT
m_PendingSendBlocks.push_back(sSetBlock(m_PosX, m_PosZ, a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta));
}
- m_ChunkBuffer.SetMeta(a_RelX, a_RelY, a_RelZ, a_BlockMeta);
+ m_ChunkData.SetMeta(a_RelX, a_RelY, a_RelZ, a_BlockMeta);
// ONLY recalculate lighting if it's necessary!
if (
@@ -2438,7 +2438,7 @@ BLOCKTYPE cChunk::GetBlock(int a_RelX, int a_RelY, int a_RelZ) const
return 0; // Clip
}
- return m_ChunkBuffer.GetBlock(a_RelX, a_RelY, a_RelZ);
+ return m_ChunkData.GetBlock(a_RelX, a_RelY, a_RelZ);
}
@@ -2448,7 +2448,7 @@ BLOCKTYPE cChunk::GetBlock(int a_RelX, int a_RelY, int a_RelZ) const
void cChunk::GetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta)
{
a_BlockType = GetBlock(a_RelX, a_RelY, a_RelZ);
- a_BlockMeta = m_ChunkBuffer.GetMeta(a_RelX, a_RelY, a_RelZ);
+ a_BlockMeta = m_ChunkData.GetMeta(a_RelX, a_RelY, a_RelZ);
}
@@ -2458,9 +2458,9 @@ void cChunk::GetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_
void cChunk::GetBlockInfo(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_Meta, NIBBLETYPE & a_SkyLight, NIBBLETYPE & a_BlockLight)
{
a_BlockType = GetBlock(a_RelX, a_RelY, a_RelZ);
- a_Meta = m_ChunkBuffer.GetMeta(a_RelX, a_RelY, a_RelZ);
- a_SkyLight = m_ChunkBuffer.GetSkyLight(a_RelX, a_RelY, a_RelZ);
- a_BlockLight = m_ChunkBuffer.GetBlockLight(a_RelX, a_RelY, a_RelZ);
+ a_Meta = m_ChunkData.GetMeta(a_RelX, a_RelY, a_RelZ);
+ a_SkyLight = m_ChunkData.GetSkyLight(a_RelX, a_RelY, a_RelZ);
+ a_BlockLight = m_ChunkData.GetBlockLight(a_RelX, a_RelY, a_RelZ);
}
diff --git a/src/Chunk.h b/src/Chunk.h
index 038be42de..4f6c4cf0a 100644
--- a/src/Chunk.h
+++ b/src/Chunk.h
@@ -3,7 +3,7 @@
#include "Entities/Entity.h"
#include "ChunkDef.h"
-#include "ChunkBuffer.h"
+#include "ChunkData.h"
#include "Simulator/FireSimulator.h"
#include "Simulator/SandSimulator.h"
@@ -324,21 +324,21 @@ public:
inline NIBBLETYPE GetMeta(int a_RelX, int a_RelY, int a_RelZ) const
{
- return m_ChunkBuffer.GetMeta(a_RelX, a_RelY, a_RelZ);
+ return m_ChunkData.GetMeta(a_RelX, a_RelY, a_RelZ);
}
inline void SetMeta(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_Meta)
{
if (!(GetMeta(a_RelX, a_RelY, a_RelZ) == a_Meta))
{
MarkDirty();
- m_ChunkBuffer.SetMeta(a_RelX, a_RelY, a_RelZ, a_Meta);
+ m_ChunkData.SetMeta(a_RelX, a_RelY, a_RelZ, a_Meta);
m_PendingSendBlocks.push_back(sSetBlock(m_PosX, m_PosZ, a_RelX, a_RelY, a_RelZ, GetBlock(a_RelX, a_RelY, a_RelZ), a_Meta));
}
}
- inline NIBBLETYPE GetBlockLight(int a_RelX, int a_RelY, int a_RelZ) const {return m_ChunkBuffer.GetBlockLight(a_RelX, a_RelY, a_RelZ); }
- inline NIBBLETYPE GetSkyLight (int a_RelX, int a_RelY, int a_RelZ) const {return m_ChunkBuffer.GetSkyLight(a_RelX, a_RelY, a_RelZ); }
+ inline NIBBLETYPE GetBlockLight(int a_RelX, int a_RelY, int a_RelZ) const {return m_ChunkData.GetBlockLight(a_RelX, a_RelY, a_RelZ); }
+ inline NIBBLETYPE GetSkyLight (int a_RelX, int a_RelY, int a_RelZ) const {return m_ChunkData.GetSkyLight(a_RelX, a_RelY, a_RelZ); }
/** Same as GetBlock(), but relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap in such a case); returns true on success */
bool UnboundedRelGetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) const;
@@ -430,7 +430,7 @@ private:
cWorld * m_World;
cChunkMap * m_ChunkMap;
- cChunkBuffer m_ChunkBuffer;
+ cChunkData m_ChunkData;
cChunkDef::HeightMap m_HeightMap;
cChunkDef::BiomeMap m_BiomeMap;
diff --git a/src/ChunkBuffer.cpp b/src/ChunkData.cpp
index 99bcdebef..160d118ad 100644
--- a/src/ChunkBuffer.cpp
+++ b/src/ChunkData.cpp
@@ -1,10 +1,10 @@
#include "Globals.h"
-#include "ChunkBuffer.h"
+#include "ChunkData.h"
-cChunkBuffer cChunkBuffer::Copy() const
+cChunkData cChunkData::Copy() const
{
- cChunkBuffer copy;
+ cChunkData copy;
for (int i = 0; i < CHUNK_SECTION_NUM; i++)
{
if(m_Sections[i])
@@ -20,7 +20,7 @@ cChunkBuffer cChunkBuffer::Copy() const
-void cChunkBuffer::CopyBlocks (BLOCKTYPE * a_dest, size_t a_Idx, size_t length) const
+void cChunkData::CopyBlocks (BLOCKTYPE * a_dest, size_t a_Idx, size_t length) const
{
for (size_t i = 0; i < CHUNK_SECTION_NUM; i++)
{
@@ -54,7 +54,7 @@ void cChunkBuffer::CopyBlocks (BLOCKTYPE * a_dest, size_t a_Idx, size_t length
-void cChunkBuffer::CopyMeta(NIBBLETYPE * a_dest) const
+void cChunkData::CopyMeta(NIBBLETYPE * a_dest) const
{
for (size_t i = 0; i < CHUNK_SECTION_NUM; i++)
{
@@ -81,7 +81,7 @@ void cChunkBuffer::CopyMeta(NIBBLETYPE * a_dest) const
-void cChunkBuffer::CopyLight(NIBBLETYPE * a_dest) const
+void cChunkData::CopyLight(NIBBLETYPE * a_dest) const
{
for (size_t i = 0; i < CHUNK_SECTION_NUM; i++)
{
@@ -109,7 +109,7 @@ void cChunkBuffer::CopyLight(NIBBLETYPE * a_dest) const
-void cChunkBuffer::CopySkyLight(NIBBLETYPE * a_dest) const
+void cChunkData::CopySkyLight(NIBBLETYPE * a_dest) const
{
for (size_t i = 0; i < CHUNK_SECTION_NUM; i++)
{
@@ -137,7 +137,7 @@ void cChunkBuffer::CopySkyLight(NIBBLETYPE * a_dest) const
-void cChunkBuffer::SetBlocks(const BLOCKTYPE * a_src)
+void cChunkData::SetBlocks(const BLOCKTYPE * a_src)
{
for (size_t i = 0; i < CHUNK_SECTION_NUM; i++)
{
@@ -175,7 +175,7 @@ void cChunkBuffer::SetBlocks(const BLOCKTYPE * a_src)
-void cChunkBuffer::SetMeta(const NIBBLETYPE * a_src)
+void cChunkData::SetMeta(const NIBBLETYPE * a_src)
{
for (size_t i = 0; i < CHUNK_SECTION_NUM; i++)
{
@@ -213,7 +213,7 @@ void cChunkBuffer::SetMeta(const NIBBLETYPE * a_src)
-void cChunkBuffer::SetLight(const NIBBLETYPE * a_src)
+void cChunkData::SetLight(const NIBBLETYPE * a_src)
{
if (!a_src) return;
for (size_t i = 0; i < CHUNK_SECTION_NUM; i++)
@@ -252,7 +252,7 @@ void cChunkBuffer::SetLight(const NIBBLETYPE * a_src)
-void cChunkBuffer::SetSkyLight (const NIBBLETYPE * a_src)
+void cChunkData::SetSkyLight (const NIBBLETYPE * a_src)
{
if (!a_src) return;
for (size_t i = 0; i < CHUNK_SECTION_NUM; i++)
@@ -292,22 +292,22 @@ void cChunkBuffer::SetSkyLight (const NIBBLETYPE * a_src)
-cChunkBuffer::sChunkSection * cChunkBuffer::Allocate() const
+cChunkData::sChunkSection * cChunkData::Allocate() const
{
// TODO: use a allocation pool
- return new cChunkBuffer::sChunkSection;
+ return new cChunkData::sChunkSection;
}
-void cChunkBuffer::Free(cChunkBuffer::sChunkSection * ptr) const
+void cChunkData::Free(cChunkData::sChunkSection * ptr) const
{
delete ptr;
}
-void cChunkBuffer::ZeroSection(cChunkBuffer::sChunkSection * ptr) const
+void cChunkData::ZeroSection(cChunkData::sChunkSection * ptr) const
{
memset(ptr->m_BlockTypes,0x00,sizeof(ptr->m_BlockTypes));
memset(ptr->m_BlockMeta,0x00,sizeof(ptr->m_BlockMeta));
diff --git a/src/ChunkBuffer.h b/src/ChunkData.h
index 266df2332..809f3cdf2 100644
--- a/src/ChunkBuffer.h
+++ b/src/ChunkData.h
@@ -17,11 +17,11 @@
// unique_ptr style interface for memory management
#endif
-class cChunkBuffer
+class cChunkData
{
public:
- cChunkBuffer()
+ cChunkData()
#if __cplusplus < 201103L
// auto_ptr style interface for memory management
: IsOwner(true)
@@ -29,7 +29,7 @@ public:
{
memset(m_Sections, 0, sizeof(m_Sections));
}
- ~cChunkBuffer()
+ ~cChunkData()
{
#if __cplusplus < 201103L
// auto_ptr style interface for memory management
@@ -43,7 +43,7 @@ public:
#if __cplusplus < 201103L
// auto_ptr style interface for memory management
- cChunkBuffer(const cChunkBuffer& other) :
+ cChunkData(const cChunkData& other) :
IsOwner(true)
{
for (int i = 0; i < CHUNK_SECTION_NUM; i++)
@@ -53,7 +53,7 @@ public:
other.IsOwner = false;
}
- cChunkBuffer& operator=(const cChunkBuffer& other)
+ cChunkData& operator=(const cChunkData& other)
{
if(&other != this)
{
@@ -76,7 +76,7 @@ public:
}
#else
// unique_ptr style interface for memory management
- cChunkBuffer(cChunkBuffer&& other)
+ cChunkData(cChunkData&& other)
{
for (int i = 0; i < CHUNK_SECTION_NUM; i++)
{
@@ -85,7 +85,7 @@ public:
}
}
- cChunkBuffer& operator=(cChunkBuffer&& other)
+ cChunkData& operator=(cChunkData&& other)
{
if(&other != this)
{
@@ -125,7 +125,7 @@ public:
(a_RelZ >= cChunkDef::Width) || (a_RelZ < 0)
)
{
- ASSERT(!"cChunkBuffer::SetMeta(): index out of range!");
+ ASSERT(!"cChunkData::SetMeta(): index out of range!");
return;
}
@@ -163,7 +163,7 @@ public:
return 0;
}
}
- ASSERT(!"cChunkBuffer::GetMeta(): coords out of chunk range!");
+ ASSERT(!"cChunkData::GetMeta(): coords out of chunk range!");
return 0;
}
@@ -175,7 +175,7 @@ public:
(a_RelZ >= cChunkDef::Width) || (a_RelZ < 0)
)
{
- ASSERT(!"cChunkBuffer::SetMeta(): index out of range!");
+ ASSERT(!"cChunkData::SetMeta(): index out of range!");
return;
}
@@ -216,7 +216,7 @@ public:
return 0;
}
}
- ASSERT(!"cChunkBuffer::GetMeta(): coords out of chunk range!");
+ ASSERT(!"cChunkData::GetMeta(): coords out of chunk range!");
return 0;
}
@@ -235,11 +235,11 @@ public:
return 0xF;
}
}
- ASSERT(!"cChunkBuffer::GetMeta(): coords out of chunk range!");
+ ASSERT(!"cChunkData::GetMeta(): coords out of chunk range!");
return 0;
}
- cChunkBuffer Copy() const;
+ cChunkData Copy() const;
void CopyBlocks (BLOCKTYPE * a_dest, size_t a_Idx = 0, size_t length = cChunkDef::NumBlocks) const;
void CopyMeta (NIBBLETYPE * a_dest) const;
void CopyLight (NIBBLETYPE * a_dest) const;
diff --git a/src/ChunkDataCallback.h b/src/ChunkDataCallback.h
index 76c45040e..340582885 100644
--- a/src/ChunkDataCallback.h
+++ b/src/ChunkDataCallback.h
@@ -3,7 +3,7 @@
#pragma once
-#include "ChunkBuffer.h"
+#include "ChunkData.h"
/** Interface class used for getting data out of a chunk using the GetAllData() function.
@@ -26,13 +26,13 @@ public:
virtual void HeightMap(const cChunkDef::HeightMap * a_HeightMap) {UNUSED(a_HeightMap); };
/// Called once to provide biome data
- virtual void BiomeData (const cChunkDef::BiomeMap * a_BiomeMap) {UNUSED(a_BiomeMap); };
+ virtual void BiomeData(const cChunkDef::BiomeMap * a_BiomeMap) {UNUSED(a_BiomeMap); };
/// Called once to let know if the chunk lighting is valid. Return value is ignored
virtual void LightIsValid(bool a_IsLightValid) {UNUSED(a_IsLightValid); };
/// Called once to export block info
- virtual void ChunkBuffer (const cChunkBuffer & a_Buffer) {UNUSED(a_Buffer); };
+ virtual void ChunkData(const cChunkData & a_Buffer) {UNUSED(a_Buffer); };
/// Called for each entity in the chunk
virtual void Entity(cEntity * a_Entity) {UNUSED(a_Entity); };
@@ -43,16 +43,16 @@ public:
/** A simple implementation of the cChunkDataCallback interface that collects all block data into a buffer
*/
-class cChunkBufferCollector :
+class cChunkDataCollector :
public cChunkDataCallback
{
public:
- cChunkBuffer m_BlockData;
+ cChunkData m_BlockData;
protected:
- virtual void ChunkBuffer(const cChunkBuffer & a_BlockData) override
+ virtual void ChunkData(const cChunkData & a_BlockData) override
{
m_BlockData = a_BlockData.Copy();
}
@@ -61,7 +61,7 @@ protected:
/** A simple implementation of the cChunkDataCallback interface that collects all block data into a single buffer
*/
-class cChunkDataCollector :
+class cChunkDataArrayCollector :
public cChunkDataCallback
{
public:
@@ -71,7 +71,7 @@ public:
protected:
- virtual void ChunkBuffer(const cChunkBuffer & a_ChunkBuffer) override
+ virtual void ChunkData(const cChunkData & a_ChunkBuffer) override
{
a_ChunkBuffer.CopyBlocks(m_BlockData);
a_ChunkBuffer.CopyMeta(m_BlockData + cChunkDef::NumBlocks);
@@ -94,7 +94,7 @@ public:
protected:
- virtual void ChunkBuffer(const cChunkBuffer & a_ChunkBuffer) override
+ virtual void ChunkData(const cChunkData & a_ChunkBuffer) override
{
a_ChunkBuffer.CopyBlocks(m_BlockTypes);
a_ChunkBuffer.CopyMeta(m_BlockMetas);
diff --git a/src/LightingThread.cpp b/src/LightingThread.cpp
index f961e35c6..879252c34 100644
--- a/src/LightingThread.cpp
+++ b/src/LightingThread.cpp
@@ -18,7 +18,7 @@
class cReader :
public cChunkDataCallback
{
- virtual void ChunkBuffer(const cChunkBuffer & a_ChunkBuffer) override
+ virtual void ChunkData(const cChunkData & a_ChunkBuffer) override
{
BLOCKTYPE * OutputRows = m_BlockTypes;
int InputIdx = 0;
diff --git a/src/WorldStorage/WSSCompact.h b/src/WorldStorage/WSSCompact.h
index 6c363d5ac..b148005f6 100644
--- a/src/WorldStorage/WSSCompact.h
+++ b/src/WorldStorage/WSSCompact.h
@@ -22,7 +22,7 @@
/// Helper class for serializing a chunk into Json
class cJsonChunkSerializer :
- public cChunkDataCollector
+ public cChunkDataArrayCollector
{
public: