summaryrefslogtreecommitdiffstats
path: root/source/World.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-09-16 09:25:23 +0200
committermadmaxoft <github@xoft.cz>2013-09-16 09:25:23 +0200
commit40d295da26c9628478d89369f65e53568feb2a5b (patch)
tree8c5f0efb108f7a57dacf6ffe2f48470579258e5d /source/World.cpp
parentAPIDump: Next batch of cWorld documentation. (diff)
downloadcuberite-40d295da26c9628478d89369f65e53568feb2a5b.tar
cuberite-40d295da26c9628478d89369f65e53568feb2a5b.tar.gz
cuberite-40d295da26c9628478d89369f65e53568feb2a5b.tar.bz2
cuberite-40d295da26c9628478d89369f65e53568feb2a5b.tar.lz
cuberite-40d295da26c9628478d89369f65e53568feb2a5b.tar.xz
cuberite-40d295da26c9628478d89369f65e53568feb2a5b.tar.zst
cuberite-40d295da26c9628478d89369f65e53568feb2a5b.zip
Diffstat (limited to 'source/World.cpp')
-rw-r--r--source/World.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/source/World.cpp b/source/World.cpp
index c36c614b1..7be83168c 100644
--- a/source/World.cpp
+++ b/source/World.cpp
@@ -612,7 +612,7 @@ void cWorld::Tick(float a_Dt)
m_ChunkMap->Tick(a_Dt);
TickClients(a_Dt);
- TickQueuedBlocks(a_Dt);
+ TickQueuedBlocks();
TickQueuedTasks();
GetSimulatorManager()->Simulate(a_Dt);
@@ -2514,7 +2514,7 @@ void cWorld::GetChunkStats(int & a_NumValid, int & a_NumDirty, int & a_NumInLigh
-void cWorld::TickQueuedBlocks(float a_Dt)
+void cWorld::TickQueuedBlocks(void)
{
if (m_BlockTickQueue.empty())
{
@@ -2526,15 +2526,16 @@ void cWorld::TickQueuedBlocks(float a_Dt)
for (std::vector<BlockTickQueueItem *>::iterator itr = m_BlockTickQueueCopy.begin(); itr != m_BlockTickQueueCopy.end(); itr++)
{
BlockTickQueueItem *Block = (*itr);
- Block->ToWait -= a_Dt;
- if (Block->ToWait <= 0)
+ Block->TicksToWait -= 1;
+ if (Block->TicksToWait <= 0)
{
+ // TODO: Handle the case when the chunk is already unloaded
BlockHandler(GetBlock(Block->X, Block->Y, Block->Z))->OnUpdate(this, Block->X, Block->Y, Block->Z);
- delete Block; //We don't have to remove it from the vector, this will happen automatically on the next tick
+ delete Block; // We don't have to remove it from the vector, this will happen automatically on the next tick
}
else
{
- m_BlockTickQueue.push_back(Block); //Keep the block in the queue
+ m_BlockTickQueue.push_back(Block); // Keep the block in the queue
}
} // for itr - m_BlockTickQueueCopy[]
}
@@ -2543,13 +2544,13 @@ void cWorld::TickQueuedBlocks(float a_Dt)
-void cWorld::QueueBlockForTick(int a_BlockX, int a_BlockY, int a_BlockZ, float a_TimeToWait)
+void cWorld::QueueBlockForTick(int a_BlockX, int a_BlockY, int a_BlockZ, int a_TicksToWait)
{
BlockTickQueueItem * Block = new BlockTickQueueItem;
Block->X = a_BlockX;
Block->Y = a_BlockY;
Block->Z = a_BlockZ;
- Block->ToWait = a_TimeToWait;
+ Block->TicksToWait = a_TicksToWait;
m_BlockTickQueue.push_back(Block);
}