1
0

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
This commit is contained in:
madmaxoft@gmail.com
2012-02-16 17:45:26 +00:00
parent 008addf5d7
commit 2928cb6853
11 changed files with 82 additions and 43 deletions

View File

@@ -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();