diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-02-23 22:02:38 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-02-23 22:02:38 +0100 |
commit | 9d3b837461afd4c7492d629ecb7e778e0ed9141a (patch) | |
tree | b693824102bf04b880fd36bfb96c04694785fb62 /source/cChunkMap.cpp | |
parent | cChunk: removed unused code (diff) | |
download | cuberite-9d3b837461afd4c7492d629ecb7e778e0ed9141a.tar cuberite-9d3b837461afd4c7492d629ecb7e778e0ed9141a.tar.gz cuberite-9d3b837461afd4c7492d629ecb7e778e0ed9141a.tar.bz2 cuberite-9d3b837461afd4c7492d629ecb7e778e0ed9141a.tar.lz cuberite-9d3b837461afd4c7492d629ecb7e778e0ed9141a.tar.xz cuberite-9d3b837461afd4c7492d629ecb7e778e0ed9141a.tar.zst cuberite-9d3b837461afd4c7492d629ecb7e778e0ed9141a.zip |
Diffstat (limited to 'source/cChunkMap.cpp')
-rw-r--r-- | source/cChunkMap.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/cChunkMap.cpp b/source/cChunkMap.cpp index bfc1bfb4d..4dff4ea45 100644 --- a/source/cChunkMap.cpp +++ b/source/cChunkMap.cpp @@ -803,6 +803,7 @@ cChunkMap::cChunkLayer::cChunkLayer(int a_LayerX, int a_LayerZ, cChunkMap * a_Pa , m_Parent( a_Parent )
, m_NumChunksLoaded( 0 )
{
+ memset(m_Chunks, 0, sizeof(m_Chunks));
}
@@ -820,13 +821,13 @@ cChunkPtr cChunkMap::cChunkLayer::GetChunk( int a_ChunkX, int a_ChunkY, int a_Ch if (!((LocalX < LAYER_SIZE) && (LocalZ < LAYER_SIZE) && (LocalX > -1) && (LocalZ > -1)))
{
ASSERT(!"Asking a cChunkLayer for a chunk that doesn't belong to it!");
- return cChunkPtr();
+ return NULL;
}
int Index = LocalX + LocalZ * LAYER_SIZE;
- if (m_Chunks[Index].get() == NULL)
+ if (m_Chunks[Index] == NULL)
{
- m_Chunks[Index].reset(new cChunk(a_ChunkX, 0, a_ChunkZ, m_Parent, m_Parent->GetWorld()));
+ m_Chunks[Index] = new cChunk(a_ChunkX, 0, a_ChunkZ, m_Parent, m_Parent->GetWorld());
}
return m_Chunks[Index];
}
@@ -890,7 +891,8 @@ void cChunkMap::cChunkLayer::UnloadUnusedChunks(void) {
if ((m_Chunks[i] != NULL) && (m_Chunks[i]->CanUnload()))
{
- m_Chunks[i].reset();
+ delete m_Chunks[i];
+ m_Chunks[i] = NULL;
}
} // for i - m_Chunks[]
}
|