From b653e6a01271c05bdbd947ab7120d10d30ecee91 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Tue, 21 Feb 2012 16:27:30 +0000 Subject: Removed cChunkPtrs from everywhere but internal cChunkMap usage. Now we should finally be threadsafe :) Also fixed a threading issue when a player connecting might have gotten stuck in "Downloading world" forever git-svn-id: http://mc-server.googlecode.com/svn/trunk@304 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cChunk.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'source/cChunk.cpp') diff --git a/source/cChunk.cpp b/source/cChunk.cpp index a783e30b4..c8ba8ba4c 100644 --- a/source/cChunk.cpp +++ b/source/cChunk.cpp @@ -67,7 +67,7 @@ sSetBlock::sSetBlock( int a_X, int a_Y, int a_Z, char a_BlockType, char a_BlockM /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // cChunk: -cChunk::cChunk(int a_X, int a_Y, int a_Z, cWorld * a_World) +cChunk::cChunk(int a_X, int a_Y, int a_Z, cChunkMap * a_ChunkMap, cWorld * a_World) : m_bCalculateLighting( false ) , m_bCalculateHeightmap( false ) , m_PosX( a_X ) @@ -82,6 +82,7 @@ cChunk::cChunk(int a_X, int a_Y, int a_Z, cWorld * a_World) , m_BlockTickY( 0 ) , m_BlockTickZ( 0 ) , m_World( a_World ) + , m_ChunkMap(a_ChunkMap) , m_IsValid(false) , m_IsDirty(false) , m_IsSaving(false) @@ -700,8 +701,8 @@ void cChunk::SpreadLight(char* a_LightBuffer) bCalcLeft = bCalcRight = bCalcFront = bCalcBack = false; // Spread to neighbour chunks X-axis - cChunkPtr LeftChunk = m_World->GetChunkNoGen( m_PosX - 1, m_PosY, m_PosZ ); - cChunkPtr RightChunk = m_World->GetChunkNoGen( m_PosX + 1, m_PosY, m_PosZ ); + cChunkPtr LeftChunk = m_ChunkMap->GetChunkNoGen( m_PosX - 1, m_PosY, m_PosZ ); + cChunkPtr RightChunk = m_ChunkMap->GetChunkNoGen( m_PosX + 1, m_PosY, m_PosZ ); char * LeftSky = NULL, *RightSky = NULL; if (LeftChunk->IsValid()) { @@ -745,8 +746,8 @@ void cChunk::SpreadLight(char* a_LightBuffer) } // Spread to neighbour chunks Z-axis - cChunkPtr FrontChunk = m_World->GetChunkNoGen( m_PosX, m_PosY, m_PosZ - 1 ); - cChunkPtr BackChunk = m_World->GetChunkNoGen( m_PosX, m_PosY, m_PosZ + 1 ); + cChunkPtr FrontChunk = m_ChunkMap->GetChunkNoGen( m_PosX, m_PosY, m_PosZ - 1 ); + cChunkPtr BackChunk = m_ChunkMap->GetChunkNoGen( m_PosX, m_PosY, m_PosZ + 1 ); char * FrontSky = NULL, * BackSky = NULL; if (FrontChunk->IsValid()) { -- cgit v1.2.3