From 2928cb6853f1e007e98f174c37d75c793a0c09cc Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Thu, 16 Feb 2012 17:45:26 +0000 Subject: cWorldGenerator speedup - doesn't call GetChunk() anymore, not queueing the chunk it's generating to be loaded recursively. cChunk fix - setting a block to the same value doesn't mark chunk dirty (resulted in un-unloadable chunks) git-svn-id: http://mc-server.googlecode.com/svn/trunk@279 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 5ebf8b656..5bd6ca1e9 100644 --- a/source/cChunk.cpp +++ b/source/cChunk.cpp @@ -805,8 +805,6 @@ void cChunk::SetBlock( int a_X, int a_Y, int a_Z, char a_BlockType, char a_Block assert(IsValid()); // Is this chunk loaded / generated? - MarkDirty(); - int index = a_Y + (a_Z * 128) + (a_X * 128 * 16); char OldBlockMeta = GetLight( m_BlockMeta, index ); char OldBlockType = m_BlockType[index]; @@ -819,6 +817,8 @@ void cChunk::SetBlock( int a_X, int a_Y, int a_Z, char a_BlockType, char a_Block return; } + MarkDirty(); + cCSLock Lock(m_CSBlockLists); m_PendingSendBlocks.push_back( index ); @@ -871,14 +871,15 @@ void cChunk::FastSetBlock( int a_X, int a_Y, int a_Z, char a_BlockType, char a_B assert(IsValid()); - MarkDirty(); - const int index = a_Y + (a_Z * 128) + (a_X * 128 * 16); const char OldBlock = m_BlockType[index]; if (OldBlock == a_BlockType) { return; } + + MarkDirty(); + m_BlockType[index] = a_BlockType; { @@ -1107,7 +1108,7 @@ bool cChunk::HasClient( cClientHandle* a_Client ) -bool cChunk::HasAnyClient(void) +bool cChunk::HasAnyClients(void) { cCSLock Lock(m_CSClients); return !m_LoadedByClient.empty(); -- cgit v1.2.3