Fixed bad merge
This commit is contained in:
parent
8133efd7f9
commit
2a7d199df6
@ -242,7 +242,7 @@ NIBBLETYPE cChunkData::GetSkyLight(int a_RelX, int a_RelY, int a_RelZ) const
|
|||||||
cChunkData cChunkData::Copy() const
|
cChunkData cChunkData::Copy() const
|
||||||
{
|
{
|
||||||
cChunkData copy(m_Pool);
|
cChunkData copy(m_Pool);
|
||||||
for (int i = 0; i < CHUNK_SECTION_NUM; i++)
|
for (size_t i = 0; i < CHUNK_SECTION_COUNT; i++)
|
||||||
{
|
{
|
||||||
if (m_Sections[i] != NULL)
|
if (m_Sections[i] != NULL)
|
||||||
{
|
{
|
||||||
@ -432,7 +432,7 @@ void cChunkData::SetBlocks(const BLOCKTYPE * a_src)
|
|||||||
|
|
||||||
void cChunkData::SetMeta(const NIBBLETYPE * a_src)
|
void cChunkData::SetMeta(const NIBBLETYPE * a_src)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < CHUNK_SECTION_NUM; i++)
|
for (size_t i = 0; i < CHUNK_SECTION_COUNT; i++)
|
||||||
{
|
{
|
||||||
const size_t segment_length = CHUNK_SECTION_HEIGHT * 16 * 16 / 2;
|
const size_t segment_length = CHUNK_SECTION_HEIGHT * 16 * 16 / 2;
|
||||||
if (m_Sections[i] != NULL)
|
if (m_Sections[i] != NULL)
|
||||||
@ -484,10 +484,10 @@ void cChunkData::SetMeta(const NIBBLETYPE * a_src)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cChunkData::SetLight(const NIBBLETYPE * a_src)
|
void cChunkData::SetBlockLight(const NIBBLETYPE * a_src)
|
||||||
{
|
{
|
||||||
if (!a_src) return;
|
if (!a_src) return;
|
||||||
for (size_t i = 0; i < CHUNK_SECTION_NUM; i++)
|
for (size_t i = 0; i < CHUNK_SECTION_COUNT; i++)
|
||||||
{
|
{
|
||||||
const size_t segment_length = CHUNK_SECTION_HEIGHT * 16 * 16 / 2;
|
const size_t segment_length = CHUNK_SECTION_HEIGHT * 16 * 16 / 2;
|
||||||
if (m_Sections[i] != NULL)
|
if (m_Sections[i] != NULL)
|
||||||
@ -542,7 +542,7 @@ void cChunkData::SetLight(const NIBBLETYPE * a_src)
|
|||||||
void cChunkData::SetSkyLight (const NIBBLETYPE * a_src)
|
void cChunkData::SetSkyLight (const NIBBLETYPE * a_src)
|
||||||
{
|
{
|
||||||
if (!a_src) return;
|
if (!a_src) return;
|
||||||
for (size_t i = 0; i < CHUNK_SECTION_NUM; i++)
|
for (size_t i = 0; i < CHUNK_SECTION_COUNT; i++)
|
||||||
{
|
{
|
||||||
const size_t segment_length = CHUNK_SECTION_HEIGHT * 16 * 16 / 2;
|
const size_t segment_length = CHUNK_SECTION_HEIGHT * 16 * 16 / 2;
|
||||||
if (m_Sections[i] != NULL)
|
if (m_Sections[i] != NULL)
|
||||||
|
@ -19,6 +19,11 @@
|
|||||||
|
|
||||||
class cChunkData
|
class cChunkData
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
static const size_t CHUNK_SECTION_HEIGHT = 16;
|
||||||
|
static const size_t CHUNK_SECTION_COUNT = (256 / CHUNK_SECTION_HEIGHT);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
struct sChunkSection;
|
struct sChunkSection;
|
||||||
@ -65,10 +70,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static const size_t CHUNK_SECTION_HEIGHT = 16;
|
|
||||||
static const size_t CHUNK_SECTION_COUNT = (256 / CHUNK_SECTION_HEIGHT);
|
|
||||||
|
|
||||||
#if __cplusplus < 201103L
|
#if __cplusplus < 201103L
|
||||||
// auto_ptr style interface for memory management
|
// auto_ptr style interface for memory management
|
||||||
mutable bool IsOwner;
|
mutable bool IsOwner;
|
||||||
|
@ -8,8 +8,14 @@ int main(int argc, char** argv)
|
|||||||
{
|
{
|
||||||
class cStarvationCallbacks
|
class cStarvationCallbacks
|
||||||
: public cAllocationPool<cChunkData::sChunkSection,1600>::cStarvationCallbacks
|
: public cAllocationPool<cChunkData::sChunkSection,1600>::cStarvationCallbacks
|
||||||
|
{
|
||||||
|
virtual void OnStartingUsingBuffer() {}
|
||||||
|
virtual void OnStopUsingBuffer() {}
|
||||||
|
virtual void OnBufferEmpty() {}
|
||||||
|
};
|
||||||
|
cAllocationPool<cChunkData::sChunkSection,1600> Pool(std::auto_ptr<cAllocationPool<cChunkData::sChunkSection,1600>::cStarvationCallbacks>(new cStarvationCallbacks()));
|
||||||
{
|
{
|
||||||
cChunkData buffer;
|
cChunkData buffer(Pool);
|
||||||
|
|
||||||
// Empty chunks
|
// Empty chunks
|
||||||
buffer.SetBlock(0, 0, 0, 0xAB);
|
buffer.SetBlock(0, 0, 0, 0xAB);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user