diff options
author | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-01-26 21:39:46 +0100 |
---|---|---|
committer | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-01-26 21:39:46 +0100 |
commit | 4e34e438f12abb31f2409ce9d50df8acc2128555 (patch) | |
tree | 68d180344b0f730779c18c927fafc07de5ee5b2b /source/cChunk.cpp | |
parent | Probably fixed a deadlock! http://www.mc-server.org/support/index.php?do=details&task_id=147 (diff) | |
download | cuberite-4e34e438f12abb31f2409ce9d50df8acc2128555.tar cuberite-4e34e438f12abb31f2409ce9d50df8acc2128555.tar.gz cuberite-4e34e438f12abb31f2409ce9d50df8acc2128555.tar.bz2 cuberite-4e34e438f12abb31f2409ce9d50df8acc2128555.tar.lz cuberite-4e34e438f12abb31f2409ce9d50df8acc2128555.tar.xz cuberite-4e34e438f12abb31f2409ce9d50df8acc2128555.tar.zst cuberite-4e34e438f12abb31f2409ce9d50df8acc2128555.zip |
Diffstat (limited to 'source/cChunk.cpp')
-rw-r--r-- | source/cChunk.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/source/cChunk.cpp b/source/cChunk.cpp index 875cefebb..04f7cc979 100644 --- a/source/cChunk.cpp +++ b/source/cChunk.cpp @@ -188,32 +188,32 @@ void cChunk::Tick(float a_Dt) m_pState->BlockListCriticalSection.Lock();
unsigned int PendingSendBlocks = m_pState->PendingSendBlocks.size();
- if( PendingSendBlocks > 1 )
- {
- cPacket_MultiBlock MultiBlock;
- MultiBlock.m_ChunkX = m_PosX;
- MultiBlock.m_ChunkZ = m_PosZ;
- MultiBlock.m_NumBlocks = (short)PendingSendBlocks;
- MultiBlock.m_BlockCoordinates = new unsigned short[PendingSendBlocks];
- MultiBlock.m_BlockTypes = new char[PendingSendBlocks];
- MultiBlock.m_BlockMetas = new char[PendingSendBlocks];
- //LOG("Sending multiblock packet for %i blocks", PendingSendBlocks );
- for( unsigned int i = 0; i < PendingSendBlocks; i++)
- {
- unsigned int index = m_pState->PendingSendBlocks[i];
- unsigned int Y = index % 128;
- unsigned int Z = (index / 128) % 16;
- unsigned int X = (index / (128*16));
-
- MultiBlock.m_BlockCoordinates[i] = (Z&0xf) | (X&0xf)<<4 | (Y&0xff)<<8;
- //LOG("X: %i Y: %i Z: %i Combo: 0x%04x", X, Y, Z, MultiBlock.m_BlockCoordinates[i] );
- MultiBlock.m_BlockTypes[i] = m_BlockType[index];
- MultiBlock.m_BlockMetas[i] = GetLight( m_BlockMeta, index );
- }
- m_pState->PendingSendBlocks.clear();
- PendingSendBlocks = m_pState->PendingSendBlocks.size();
- Broadcast( MultiBlock );
- }
+ if( PendingSendBlocks > 1 )
+ {
+ cPacket_MultiBlock MultiBlock;
+ MultiBlock.m_ChunkX = m_PosX;
+ MultiBlock.m_ChunkZ = m_PosZ;
+ MultiBlock.m_NumBlocks = (short)PendingSendBlocks;
+ MultiBlock.m_BlockCoordinates = new unsigned short[PendingSendBlocks];
+ MultiBlock.m_BlockTypes = new char[PendingSendBlocks];
+ MultiBlock.m_BlockMetas = new char[PendingSendBlocks];
+ //LOG("Sending multiblock packet for %i blocks", PendingSendBlocks );
+ for( unsigned int i = 0; i < PendingSendBlocks; i++)
+ {
+ unsigned int index = m_pState->PendingSendBlocks[i];
+ unsigned int Y = index % 128;
+ unsigned int Z = (index / 128) % 16;
+ unsigned int X = (index / (128*16));
+
+ MultiBlock.m_BlockCoordinates[i] = (Z&0xf) | (X&0xf)<<4 | (Y&0xff)<<8;
+ //LOG("X: %i Y: %i Z: %i Combo: 0x%04x", X, Y, Z, MultiBlock.m_BlockCoordinates[i] );
+ MultiBlock.m_BlockTypes[i] = m_BlockType[index];
+ MultiBlock.m_BlockMetas[i] = GetLight( m_BlockMeta, index );
+ }
+ m_pState->PendingSendBlocks.clear();
+ PendingSendBlocks = m_pState->PendingSendBlocks.size();
+ Broadcast( MultiBlock );
+ }
if( PendingSendBlocks > 0 )
{
for( unsigned int i = 0; i < PendingSendBlocks; i++)
@@ -969,7 +969,7 @@ bool cChunk::SaveToDisk() char SourceFile[128];
sprintf_s(SourceFile, 128, "world/X%i_Y%i_Z%i.bin", m_PosX, m_PosY, m_PosZ );
- #ifdef _WIN32
+ #ifdef _WIN32
{
SECURITY_ATTRIBUTES Attrib;
Attrib.nLength = sizeof(SECURITY_ATTRIBUTES);
@@ -979,7 +979,7 @@ bool cChunk::SaveToDisk() }
#else
{
- mkdir("world", S_IRWXU | S_IRWXG | S_IRWXO);
+ mkdir("world", S_IRWXU | S_IRWXG | S_IRWXO);
}
#endif
|