From 499745c1c7a865941b3c102532777c19dfb92ca4 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 18 Feb 2012 17:53:22 +0000 Subject: Thread-safe chunk generation, storage and generator are queried for progress while initializing server Note that this commit breaks foliage generation - there are no trees in the chunks generated! git-svn-id: http://mc-server.googlecode.com/svn/trunk@292 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cChunk.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source/cChunk.cpp') diff --git a/source/cChunk.cpp b/source/cChunk.cpp index 5bd6ca1e9..b5e56f3c6 100644 --- a/source/cChunk.cpp +++ b/source/cChunk.cpp @@ -109,6 +109,8 @@ void cChunk::SetValid(bool a_SendToClients) { m_IsValid = true; + m_World->GetChunkMap()->ChunkValidated(); + if (!a_SendToClients) { return; @@ -177,7 +179,7 @@ void cChunk::MarkSaved(void) void cChunk::MarkLoaded(void) { m_IsDirty = false; - m_IsValid = true; + SetValid(); } @@ -240,8 +242,6 @@ void cChunk::SetAllData(const char * a_BlockData, cEntityList & a_Entities, cBlo CreateBlockEntities(); CalculateHeightmap(); - - MarkDirty(); } @@ -511,7 +511,7 @@ void cChunk::Tick(float a_Dt, MTRand & a_TickRandom) -char cChunk::GetHeight( int a_X, int a_Z ) +int cChunk::GetHeight( int a_X, int a_Z ) { if( a_X >= 0 && a_X < 16 && a_Z >= 0 && a_Z < 16 ) { @@ -756,10 +756,10 @@ void cChunk::SpreadLight(char* a_LightBuffer) } } - if( bCalcLeft ) m_World->ReSpreadLighting( LeftChunk ); - if( bCalcRight ) m_World->ReSpreadLighting( RightChunk ); - if( bCalcFront ) m_World->ReSpreadLighting( FrontChunk ); - if( bCalcBack ) m_World->ReSpreadLighting( BackChunk ); + if( bCalcLeft ) m_World->ReSpreadLighting( m_PosX - 1, m_PosY, m_PosZ ); + if( bCalcRight ) m_World->ReSpreadLighting( m_PosX + 1, m_PosY, m_PosZ ); + if( bCalcFront ) m_World->ReSpreadLighting( m_PosX, m_PosY, m_PosZ - 1 ); + if( bCalcBack ) m_World->ReSpreadLighting( m_PosX, m_PosY, m_PosZ + 1 ); } -- cgit v1.2.3