summaryrefslogtreecommitdiffstats
path: root/src/World.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/World.h')
-rw-r--r--src/World.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/World.h b/src/World.h
index 078a25562..aeab7bfa5 100644
--- a/src/World.h
+++ b/src/World.h
@@ -103,8 +103,12 @@ public:
class cTask
{
public:
+ cTask(const cTask & other) = default;
virtual ~cTask() {}
virtual void Run(cWorld & a_World) = 0;
+
+ protected:
+ cTask() {}
} ;
typedef SharedPtr<cTask> cTaskPtr;
@@ -142,6 +146,21 @@ public:
std::vector<Vector3i> m_SendQueue;
};
+ class cTaskLambda :
+ public cTask
+ {
+
+ public:
+ cTaskLambda(std::function<void(cWorld&)> a_Func) :
+ m_func(a_Func)
+ { }
+
+ protected:
+ virtual void Run(cWorld & a_World) override;
+
+ std::function<void(cWorld&)> m_func;
+ };
+
static const char * GetClassStatic(void) // Needed for ManualBindings's ForEach templates
{
@@ -694,6 +713,18 @@ public:
AString GetLinkedOverworldName(void) const { return m_LinkedOverworldName; }
void SetLinkedOverworldName(const AString & a_Name) { m_LinkedOverworldName = a_Name; }
+ /** Returns or sets the minumim or maximum netherportal width */
+ virtual int GetMinNetherPortalWidth(void) const override { return m_MinNetherPortalWidth; }
+ virtual int GetMaxNetherPortalWidth(void) const override { return m_MaxNetherPortalWidth; }
+ virtual void SetMinNetherPortalWidth(int a_NewMinWidth) override { m_MinNetherPortalWidth = a_NewMinWidth; }
+ virtual void SetMaxNetherPortalWidth(int a_NewMaxWidth) override { m_MaxNetherPortalWidth = a_NewMaxWidth; }
+
+ /** Returns or sets the minumim or maximum netherportal height */
+ virtual int GetMinNetherPortalHeight(void) const override { return m_MinNetherPortalHeight; }
+ virtual int GetMaxNetherPortalHeight(void) const override { return m_MaxNetherPortalHeight; }
+ virtual void SetMinNetherPortalHeight(int a_NewMinHeight) override { m_MinNetherPortalHeight = a_NewMinHeight; }
+ virtual void SetMaxNetherPortalHeight(int a_NewMaxHeight) override { m_MaxNetherPortalHeight = a_NewMaxHeight; }
+
// tolua_end
/** Saves all chunks immediately. Dangerous interface, may deadlock, use QueueSaveAllChunks() instead */
@@ -705,6 +736,9 @@ public:
/** Queues a task onto the tick thread. The task object will be deleted once the task is finished */
void QueueTask(cTaskPtr a_Task); // Exported in ManualBindings.cpp
+ /** Queues a lambda task onto the tick thread, with the specified delay. */
+ void ScheduleTask(int a_DelayTicks, std::function<void(cWorld&)> a_Func);
+
/** Queues a task onto the tick thread, with the specified delay. */
void ScheduleTask(int a_DelayTicks, cTaskPtr a_Task);
@@ -920,6 +954,12 @@ private:
double m_SpawnY;
double m_SpawnZ;
+ // Variables defining the minimum and maximum size for a nether portal
+ int m_MinNetherPortalWidth;
+ int m_MaxNetherPortalWidth;
+ int m_MinNetherPortalHeight;
+ int m_MaxNetherPortalHeight;
+
bool m_BroadcastDeathMessages;
bool m_BroadcastAchievementMessages;