diff options
Diffstat (limited to '')
-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 ( |