diff options
author | Mattes D <github@xoft.cz> | 2016-09-05 15:05:54 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2016-09-05 15:05:54 +0200 |
commit | f7029eddd4120f672c59a4b3a4395832f4de8863 (patch) | |
tree | 81c93ca7c5c03ebdde2401e86dd8c02665710384 /src/World.h | |
parent | PluginLua: Removed unneeded assignment. (diff) | |
parent | Configurable dirty unused chunk cap to avoid RAM overuse (#3359) (diff) | |
download | cuberite-f7029eddd4120f672c59a4b3a4395832f4de8863.tar cuberite-f7029eddd4120f672c59a4b3a4395832f4de8863.tar.gz cuberite-f7029eddd4120f672c59a4b3a4395832f4de8863.tar.bz2 cuberite-f7029eddd4120f672c59a4b3a4395832f4de8863.tar.lz cuberite-f7029eddd4120f672c59a4b3a4395832f4de8863.tar.xz cuberite-f7029eddd4120f672c59a4b3a4395832f4de8863.tar.zst cuberite-f7029eddd4120f672c59a4b3a4395832f4de8863.zip |
Diffstat (limited to 'src/World.h')
-rw-r--r-- | src/World.h | 12 |
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) |