switched to using m_WorldAge rather than m_TickID
This commit is contained in:
parent
287144839e
commit
160a27cced
@ -870,7 +870,7 @@ void cWorld::TickScheduledTasks()
|
|||||||
{
|
{
|
||||||
cCSLock Lock(m_CSScheduledTasks);
|
cCSLock Lock(m_CSScheduledTasks);
|
||||||
ScheduledTaskList::iterator itr = m_ScheduledTasks.begin();
|
ScheduledTaskList::iterator itr = m_ScheduledTasks.begin();
|
||||||
while (itr != m_ScheduledTasks.end() && (*itr)->Ticks > 0)
|
while (itr != m_ScheduledTasks.end() && (*itr)->Ticks < m_WorldAge)
|
||||||
{
|
{
|
||||||
Tasks.push_back(m_ScheduledTasks.front());
|
Tasks.push_back(m_ScheduledTasks.front());
|
||||||
m_ScheduledTasks.pop_front();
|
m_ScheduledTasks.pop_front();
|
||||||
@ -883,9 +883,6 @@ void cWorld::TickScheduledTasks()
|
|||||||
(*itr)->Run(*this);
|
(*itr)->Run(*this);
|
||||||
delete *itr;
|
delete *itr;
|
||||||
} // for itr - m_Tasks[]
|
} // for itr - m_Tasks[]
|
||||||
|
|
||||||
// Increment TickID
|
|
||||||
m_TickID = (m_TickID+1) & 0x7FFFFFFF;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2622,11 +2619,11 @@ void cWorld::QueueTask(cTask * a_Task)
|
|||||||
|
|
||||||
void cWorld::ScheduleTask(cScheduledTask * a_Task)
|
void cWorld::ScheduleTask(cScheduledTask * a_Task)
|
||||||
{
|
{
|
||||||
a_Task->Ticks = (a_Task->Ticks + m_TickID) & 0x7FFFFFFF;
|
a_Task->Ticks = a_Task->Ticks + m_WorldAge;
|
||||||
cCSLock Lock(m_CSScheduledTasks);
|
cCSLock Lock(m_CSScheduledTasks);
|
||||||
for(ScheduledTaskList::iterator itr = m_ScheduledTasks.begin(); itr != m_ScheduledTasks.end(); itr++)
|
for(ScheduledTaskList::iterator itr = m_ScheduledTasks.begin(); itr != m_ScheduledTasks.end(); itr++)
|
||||||
{
|
{
|
||||||
if((*itr)->Ticks >= a_Task->Ticks && (a_Task->Ticks > m_TickID || (*itr)->Ticks < m_TickID))
|
if((*itr)->Ticks >= a_Task->Ticks)
|
||||||
{
|
{
|
||||||
m_ScheduledTasks.insert(itr, a_Task);
|
m_ScheduledTasks.insert(itr, a_Task);
|
||||||
return;
|
return;
|
||||||
|
@ -772,9 +772,6 @@ private:
|
|||||||
/// the future; guarded by m_CSScheduledTasks
|
/// the future; guarded by m_CSScheduledTasks
|
||||||
ScheduledTaskList m_ScheduledTasks;
|
ScheduledTaskList m_ScheduledTasks;
|
||||||
|
|
||||||
/// Current Tick number for sceduled tasks
|
|
||||||
long m_TickID;
|
|
||||||
|
|
||||||
/// Guards m_Clients
|
/// Guards m_Clients
|
||||||
cCriticalSection m_CSClients;
|
cCriticalSection m_CSClients;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user