From 4e34e438f12abb31f2409ce9d50df8acc2128555 Mon Sep 17 00:00:00 2001 From: faketruth Date: Thu, 26 Jan 2012 20:39:46 +0000 Subject: Working on a new plugin design with Lua. While retaining backwards compatibility of course... In this new design a plugin consists of a folder with Lua files, this should enable plugin developers to keep things separate and have more overview. git-svn-id: http://mc-server.googlecode.com/svn/trunk@172 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cChunk.cpp | 56 +++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'source/cChunk.cpp') 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 -- cgit v1.2.3