diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/World.cpp | 3 | ||||
-rw-r--r-- | src/World.h | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/World.cpp b/src/World.cpp index 1866d4eaf..599bd1d6f 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -471,6 +471,8 @@ void cWorld::Start(cDeadlockDetect & a_DeadlockDetect) int GameMode = IniFile.GetValueSetI("General", "Gamemode", static_cast<int>(m_GameMode)); int Weather = IniFile.GetValueSetI("General", "Weather", static_cast<int>(m_Weather)); + m_WorldAge = std::chrono::milliseconds(IniFile.GetValueSetI("General", "WorldAgeMS", 0LL)); + // Load the weather frequency data: if (m_Dimension == dimOverworld) { @@ -937,6 +939,7 @@ void cWorld::Stop(cDeadlockDetect & a_DeadlockDetect) IniFile.SetValueB("General", "IsDaylightCycleEnabled", m_IsDaylightCycleEnabled); IniFile.SetValueI("General", "Weather", static_cast<int>(m_Weather)); IniFile.SetValueI("General", "TimeInTicks", GetTimeOfDay()); + IniFile.SetValueI("General", "WorldAgeMS", static_cast<Int64>(m_WorldAge.count())); IniFile.WriteFile(m_IniFileName); m_TickThread.Stop(); diff --git a/src/World.h b/src/World.h index 591b61911..5957f5432 100644 --- a/src/World.h +++ b/src/World.h @@ -897,8 +897,11 @@ private: bool m_BroadcastAchievementMessages; bool m_IsDaylightCycleEnabled; - // std::chrono::milliseconds is guaranteed to be good for 292 years by the standard. - std::chrono::milliseconds m_WorldAge; + + /** The age of the world. + Monotonic, always increasing each game tick, persistent across server restart. */ + 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_LastChunkCheck; // The last WorldAge (in ticks) in which unloading and possibly saving was triggered |