diff options
author | madmaxoft <github@xoft.cz> | 2013-08-18 22:44:22 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2013-08-18 22:44:22 +0200 |
commit | 7b10068370e42def4e28785d2e49acba52bad1fd (patch) | |
tree | 7cd6f4a961981f934127f097798317611946285a /source/Chunk.cpp | |
parent | Removed SetServerBlock griefing. (diff) | |
download | cuberite-7b10068370e42def4e28785d2e49acba52bad1fd.tar cuberite-7b10068370e42def4e28785d2e49acba52bad1fd.tar.gz cuberite-7b10068370e42def4e28785d2e49acba52bad1fd.tar.bz2 cuberite-7b10068370e42def4e28785d2e49acba52bad1fd.tar.lz cuberite-7b10068370e42def4e28785d2e49acba52bad1fd.tar.xz cuberite-7b10068370e42def4e28785d2e49acba52bad1fd.tar.zst cuberite-7b10068370e42def4e28785d2e49acba52bad1fd.zip |
Diffstat (limited to 'source/Chunk.cpp')
-rw-r--r-- | source/Chunk.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/source/Chunk.cpp b/source/Chunk.cpp index 62d411b0c..a2cfb7ead 100644 --- a/source/Chunk.cpp +++ b/source/Chunk.cpp @@ -440,6 +440,9 @@ void cChunk::Tick(float a_Dt) (*itr)->SendUnloadChunk(m_PosX, m_PosZ); } m_UnloadQuery.clear(); + + // Set all blocks that have been queued for setting later: + ProcessQueuedSetBlocks(); CheckBlocks(); @@ -544,6 +547,30 @@ void cChunk::MoveEntityToNewChunk(cEntity * a_Entity) +void cChunk::ProcessQueuedSetBlocks(void) +{ + Int64 CurrTick = m_World->GetWorldAge(); + for (sSetBlockQueueVector::iterator itr = m_SetBlockQueue.begin(); itr != m_SetBlockQueue.end();) + { + if (itr->m_Tick < CurrTick) + { + // Not yet + ++itr; + continue; + } + else + { + // Now is the time to set the block + SetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ, itr->m_BlockType, itr->m_BlockMeta); + itr = m_SetBlockQueue.erase(itr); + } + } // for itr - m_SetBlockQueue[] +} + + + + + void cChunk::BroadcastPendingBlockChanges(void) { sSetBlockVector Changes; @@ -1492,6 +1519,15 @@ void cChunk::SetBlock( int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType +void cChunk::QueueSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Int64 a_Tick) +{ + m_SetBlockQueue.push_back(sSetBlockQueueItem(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta, a_Tick)); +} + + + + + void cChunk::QueueTickBlock(int a_RelX, int a_RelY, int a_RelZ) { ASSERT ( |