summaryrefslogtreecommitdiffstats
path: root/src/World.h
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-09-03 17:38:29 +0200
committerGitHub <noreply@github.com>2016-09-03 17:38:29 +0200
commit7e9e7f79110e398a4d2b07de3093eaccd551f013 (patch)
tree96098b99f146a40f42c4322d96fcd061b9548d8a /src/World.h
parentEntities now bail out of ticks if destroyed (#3363) (diff)
downloadcuberite-7e9e7f79110e398a4d2b07de3093eaccd551f013.tar
cuberite-7e9e7f79110e398a4d2b07de3093eaccd551f013.tar.gz
cuberite-7e9e7f79110e398a4d2b07de3093eaccd551f013.tar.bz2
cuberite-7e9e7f79110e398a4d2b07de3093eaccd551f013.tar.lz
cuberite-7e9e7f79110e398a4d2b07de3093eaccd551f013.tar.xz
cuberite-7e9e7f79110e398a4d2b07de3093eaccd551f013.tar.zst
cuberite-7e9e7f79110e398a4d2b07de3093eaccd551f013.zip
Diffstat (limited to 'src/World.h')
-rw-r--r--src/World.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/World.h b/src/World.h
index a00e181b6..a33831eb9 100644
--- a/src/World.h
+++ b/src/World.h
@@ -683,7 +683,10 @@ public:
void ScheduleTask(int a_DelayTicks, std::function<void(cWorld &)> a_Task);
/** Returns the number of chunks loaded */
- int GetNumChunks() const; // tolua_export
+ size_t GetNumChunks() const; // tolua_export
+
+ /** Returns the number of unused dirty chunks. That's the number of chunks that we can save and then unload. */
+ size_t GetNumUnusedDirtyChunks(void) const; // tolua_export
/** Returns the number of chunks loaded and dirty, and in the lighting queue */
void GetChunkStats(int & a_NumValid, int & a_NumDirty, int & a_NumInLightingQueue);
@@ -851,6 +854,11 @@ private:
} ;
+ /** The maximum number of allowed unused dirty chunks for this world.
+ Loaded from config, enforced every 10 seconds by freeing some unused dirty chunks
+ if this was exceeded. */
+ size_t m_UnusedDirtyChunksCap;
+
AString m_WorldName;
/** The name of the overworld that portals in this world should link to.
@@ -889,7 +897,7 @@ private:
std::chrono::milliseconds m_WorldAge;
std::chrono::milliseconds m_TimeOfDay;
cTickTimeLong m_LastTimeUpdate; // The tick in which the last time update has been sent.
- cTickTimeLong m_LastUnload; // The last WorldAge (in ticks) in which unloading was triggerred
+ cTickTimeLong m_LastChunkCheck; // The last WorldAge (in ticks) in which unloading and possibly saving was triggered
cTickTimeLong m_LastSave; // The last WorldAge (in ticks) in which save-all was triggerred
std::map<cMonster::eFamily, cTickTimeLong> m_LastSpawnMonster; // The last WorldAge (in ticks) in which a monster was spawned (for each megatype of monster) // MG TODO : find a way to optimize without creating unmaintenability (if mob IDs are becoming unrowed)