From 4271d719b68521f91770574b3064525512116670 Mon Sep 17 00:00:00 2001 From: Howaner Date: Thu, 7 Aug 2014 01:07:32 +0200 Subject: Added SetDoDaylightCycle() and IsDaylightCycleEnabled() to cWorld. I need this for a GameRule plugin. --- src/World.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/World.h') diff --git a/src/World.h b/src/World.h index 90b798e8e..8ddc69118 100644 --- a/src/World.h +++ b/src/World.h @@ -145,7 +145,17 @@ public: // tolua_begin int GetTicksUntilWeatherChange(void) const { return m_WeatherInterval; } - + + /** Is the daylight cyclus enabled? */ + virtual bool IsDaylightCycleEnabled(void) const { return m_DoDaylightCycle; } + + /** Sets the daylight cyclus to true/false. */ + virtual void SetDoDaylightCycle(bool a_DoDaylightCycle) + { + m_DoDaylightCycle = a_DoDaylightCycle; + BroadcastTimeUpdate(); + } + virtual Int64 GetWorldAge (void) const override { return m_WorldAge; } virtual Int64 GetTimeOfDay(void) const override { return m_TimeOfDay; } @@ -158,6 +168,7 @@ public: { m_TimeOfDay = a_TimeOfDay; m_TimeOfDaySecs = (double)a_TimeOfDay / 20.0; + UpdateSkyDarkness(); BroadcastTimeUpdate(); } @@ -868,6 +879,7 @@ private: bool m_BroadcastDeathMessages; bool m_BroadcastAchievementMessages; + bool m_DoDaylightCycle; // Is the daylight cyclus enabled? double m_WorldAgeSecs; // World age, in seconds. Is only incremented, cannot be set by plugins. double m_TimeOfDaySecs; // Time of day in seconds. Can be adjusted. Is wrapped to zero each day. Int64 m_WorldAge; // World age in ticks, calculated off of m_WorldAgeSecs -- cgit v1.2.3 From 32e1e9a5536f92d074d51cca207f21c372973629 Mon Sep 17 00:00:00 2001 From: Howaner Date: Fri, 8 Aug 2014 18:38:20 +0200 Subject: Renamed m_DoDaylightCycle to m_CycleDaylight. --- src/World.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/World.h') diff --git a/src/World.h b/src/World.h index 8ddc69118..4e85087fc 100644 --- a/src/World.h +++ b/src/World.h @@ -147,12 +147,12 @@ public: int GetTicksUntilWeatherChange(void) const { return m_WeatherInterval; } /** Is the daylight cyclus enabled? */ - virtual bool IsDaylightCycleEnabled(void) const { return m_DoDaylightCycle; } + virtual bool IsDaylightCycleEnabled(void) const { return m_CycleDaylight; } /** Sets the daylight cyclus to true/false. */ - virtual void SetDoDaylightCycle(bool a_DoDaylightCycle) + virtual void SetDoDaylightCycle(bool a_CycleDaylight) { - m_DoDaylightCycle = a_DoDaylightCycle; + m_CycleDaylight = a_CycleDaylight; BroadcastTimeUpdate(); } @@ -879,7 +879,7 @@ private: bool m_BroadcastDeathMessages; bool m_BroadcastAchievementMessages; - bool m_DoDaylightCycle; // Is the daylight cyclus enabled? + bool m_CycleDaylight; // Is the daylight cyclus enabled? double m_WorldAgeSecs; // World age, in seconds. Is only incremented, cannot be set by plugins. double m_TimeOfDaySecs; // Time of day in seconds. Can be adjusted. Is wrapped to zero each day. Int64 m_WorldAge; // World age in ticks, calculated off of m_WorldAgeSecs -- cgit v1.2.3 From cccc321384be18d4ac75e83abf3ce4d19a2a3d56 Mon Sep 17 00:00:00 2001 From: Howaner Date: Sun, 10 Aug 2014 16:46:03 +0200 Subject: Renamed functions. --- src/World.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/World.h') diff --git a/src/World.h b/src/World.h index 4e85087fc..6df1758e9 100644 --- a/src/World.h +++ b/src/World.h @@ -147,12 +147,12 @@ public: int GetTicksUntilWeatherChange(void) const { return m_WeatherInterval; } /** Is the daylight cyclus enabled? */ - virtual bool IsDaylightCycleEnabled(void) const { return m_CycleDaylight; } + virtual bool IsDaylightCycleEnabled(void) const { return m_IsDaylightCycleEnabled; } /** Sets the daylight cyclus to true/false. */ - virtual void SetDoDaylightCycle(bool a_CycleDaylight) + virtual void SetDaylightCycleEnabled(bool a_IsDaylightCycleEnabled) { - m_CycleDaylight = a_CycleDaylight; + m_IsDaylightCycleEnabled = a_IsDaylightCycleEnabled; BroadcastTimeUpdate(); } @@ -879,7 +879,7 @@ private: bool m_BroadcastDeathMessages; bool m_BroadcastAchievementMessages; - bool m_CycleDaylight; // Is the daylight cyclus enabled? + bool m_IsDaylightCycleEnabled; double m_WorldAgeSecs; // World age, in seconds. Is only incremented, cannot be set by plugins. double m_TimeOfDaySecs; // Time of day in seconds. Can be adjusted. Is wrapped to zero each day. Int64 m_WorldAge; // World age in ticks, calculated off of m_WorldAgeSecs -- cgit v1.2.3