From 9d3b837461afd4c7492d629ecb7e778e0ed9141a Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Thu, 23 Feb 2012 21:02:38 +0000 Subject: Made cChunkPtr a plain old pointer again, since it's safe now git-svn-id: http://mc-server.googlecode.com/svn/trunk@324 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cChunk.h | 2 +- source/cChunkMap.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/cChunk.h b/source/cChunk.h index 8e0e9e627..b13cbd920 100644 --- a/source/cChunk.h +++ b/source/cChunk.h @@ -280,7 +280,7 @@ private: cClientHandleList GetAllClients(void) const {return m_LoadedByClient; } }; -typedef std::tr1::shared_ptr cChunkPtr; +typedef cChunk * cChunkPtr; typedef std::list cChunkPtrList; 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[] } -- cgit v1.2.3