summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-01-19 16:46:34 +0100
committerMattes D <github@xoft.cz>2014-01-19 16:46:34 +0100
commit6976735a53db205db77ca1aefcbaf4f03e342184 (patch)
treee45a63513707459376a82abf41889c90424a8bef /src/World.cpp
parentUpdated Core. (diff)
parentFixed iterators bug (diff)
downloadcuberite-6976735a53db205db77ca1aefcbaf4f03e342184.tar
cuberite-6976735a53db205db77ca1aefcbaf4f03e342184.tar.gz
cuberite-6976735a53db205db77ca1aefcbaf4f03e342184.tar.bz2
cuberite-6976735a53db205db77ca1aefcbaf4f03e342184.tar.lz
cuberite-6976735a53db205db77ca1aefcbaf4f03e342184.tar.xz
cuberite-6976735a53db205db77ca1aefcbaf4f03e342184.tar.zst
cuberite-6976735a53db205db77ca1aefcbaf4f03e342184.zip
Diffstat (limited to 'src/World.cpp')
-rw-r--r--src/World.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 8e7b6171c..6520702c7 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -871,16 +871,11 @@ void cWorld::TickScheduledTasks()
// Make a copy of the tasks to avoid deadlocks on accessing m_Tasks
{
cCSLock Lock(m_CSScheduledTasks);
- ScheduledTaskList::iterator itr = m_ScheduledTasks.begin();
- while (itr != m_ScheduledTasks.end() && (*itr)->Ticks > 0)
+ while (!m_ScheduledTasks.empty() && m_ScheduledTasks.front()->Ticks < m_WorldAge)
{
Tasks.push_back(m_ScheduledTasks.front());
m_ScheduledTasks.pop_front();
}
- for(;itr != m_ScheduledTasks.end(); itr++)
- {
- (*itr)->Ticks--;
- }
}
// Execute and delete each task:
@@ -2634,6 +2629,7 @@ void cWorld::QueueTask(cTask * a_Task)
void cWorld::ScheduleTask(cScheduledTask * a_Task)
{
+ a_Task->Ticks = a_Task->Ticks + m_WorldAge;
cCSLock Lock(m_CSScheduledTasks);
for(ScheduledTaskList::iterator itr = m_ScheduledTasks.begin(); itr != m_ScheduledTasks.end(); itr++)
{