summaryrefslogtreecommitdiffstats
path: root/src/World.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-03-20 15:13:33 +0100
committerMattes D <github@xoft.cz>2015-03-20 15:13:33 +0100
commit781c8683f7021ceb27dc83c19f7207322f2227d1 (patch)
tree9e723a35ce9d43627da12fd1901bde9ffed20e4b /src/World.h
parentUpdated Core. (diff)
downloadcuberite-781c8683f7021ceb27dc83c19f7207322f2227d1.tar
cuberite-781c8683f7021ceb27dc83c19f7207322f2227d1.tar.gz
cuberite-781c8683f7021ceb27dc83c19f7207322f2227d1.tar.bz2
cuberite-781c8683f7021ceb27dc83c19f7207322f2227d1.tar.lz
cuberite-781c8683f7021ceb27dc83c19f7207322f2227d1.tar.xz
cuberite-781c8683f7021ceb27dc83c19f7207322f2227d1.tar.zst
cuberite-781c8683f7021ceb27dc83c19f7207322f2227d1.zip
Diffstat (limited to 'src/World.h')
-rw-r--r--src/World.h20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/World.h b/src/World.h
index 0decc8c6e..f7d5cdc60 100644
--- a/src/World.h
+++ b/src/World.h
@@ -106,7 +106,8 @@ public:
virtual void Run(cWorld & a_World) = 0;
} ;
- typedef std::vector<std::unique_ptr<cTask>> cTasks;
+ typedef SharedPtr<cTask> cTaskPtr;
+ typedef std::vector<cTaskPtr> cTasks;
class cTaskSaveAllChunks :
@@ -691,11 +692,10 @@ public:
void QueueSaveAllChunks(void); // tolua_export
/** Queues a task onto the tick thread. The task object will be deleted once the task is finished */
- void QueueTask(std::unique_ptr<cTask> a_Task); // Exported in ManualBindings.cpp
+ void QueueTask(cTaskPtr a_Task); // Exported in ManualBindings.cpp
- /** Queues a task onto the tick thread, with the specified delay.
- The task object will be deleted once the task is finished */
- void ScheduleTask(int a_DelayTicks, cTask * a_Task);
+ /** Queues a task onto the tick thread, with the specified delay. */
+ void ScheduleTask(int a_DelayTicks, cTaskPtr a_Task);
/** Returns the number of chunks loaded */
int GetNumChunks() const; // tolua_export
@@ -867,20 +867,16 @@ private:
{
public:
Int64 m_TargetTick;
- cTask * m_Task;
+ cTaskPtr m_Task;
/** Creates a new scheduled task; takes ownership of the task object passed to it. */
- cScheduledTask(Int64 a_TargetTick, cTask * a_Task) :
+ cScheduledTask(Int64 a_TargetTick, cTaskPtr a_Task) :
m_TargetTick(a_TargetTick),
m_Task(a_Task)
{
}
- virtual ~cScheduledTask()
- {
- delete m_Task;
- m_Task = nullptr;
- }
+ virtual ~cScheduledTask() {}
};
typedef std::unique_ptr<cScheduledTask> cScheduledTaskPtr;