summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-01-17 19:07:33 +0100
committerTycho <work.tycho+git@gmail.com>2014-01-17 19:07:33 +0100
commitce030bc7c9838a2c0c60b18a0e53bb40ff0fda26 (patch)
tree8da7f97bc253394e6aeec25e62973bbe494626d2 /src/World.cpp
parentAPIDump: Updated cPluginManager:GetAllPlugins(). (diff)
downloadcuberite-ce030bc7c9838a2c0c60b18a0e53bb40ff0fda26.tar
cuberite-ce030bc7c9838a2c0c60b18a0e53bb40ff0fda26.tar.gz
cuberite-ce030bc7c9838a2c0c60b18a0e53bb40ff0fda26.tar.bz2
cuberite-ce030bc7c9838a2c0c60b18a0e53bb40ff0fda26.tar.lz
cuberite-ce030bc7c9838a2c0c60b18a0e53bb40ff0fda26.tar.xz
cuberite-ce030bc7c9838a2c0c60b18a0e53bb40ff0fda26.tar.zst
cuberite-ce030bc7c9838a2c0c60b18a0e53bb40ff0fda26.zip
Diffstat (limited to '')
-rw-r--r--src/World.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/World.cpp b/src/World.cpp
index edf27050d..e4c03699f 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -875,10 +875,6 @@ void cWorld::TickScheduledTasks()
Tasks.push_back(m_ScheduledTasks.front());
m_ScheduledTasks.pop_front();
}
- for(;itr != m_ScheduledTasks.end(); itr++)
- {
- (*itr)->Ticks--;
- }
}
// Execute and delete each task:
@@ -887,6 +883,9 @@ void cWorld::TickScheduledTasks()
(*itr)->Run(*this);
delete *itr;
} // for itr - m_Tasks[]
+
+ // Increment TickID
+ m_TickID = (m_TickID+1) &0xFFFF;
}
@@ -2623,10 +2622,11 @@ void cWorld::QueueTask(cTask * a_Task)
void cWorld::ScheduleTask(cScheduledTask * a_Task)
{
+ a_Task->Ticks = (a_Task->Ticks + m_TickID) & 0xFFFF;
cCSLock Lock(m_CSScheduledTasks);
for(ScheduledTaskList::iterator itr = m_ScheduledTasks.begin(); itr != m_ScheduledTasks.end(); itr++)
{
- if((*itr)->Ticks >= a_Task->Ticks)
+ if((*itr)->Ticks >= a_Task->Ticks && (a_Task->Ticks > m_TickID || (*itr)->Ticks < m_TickID))
{
m_ScheduledTasks.insert(itr, a_Task);
return;