From ca8e56c15a26bc5f3d1dffe5fd39e1ca4b82d6f8 Mon Sep 17 00:00:00 2001 From: est31 Date: Tue, 27 Oct 2015 21:03:59 +0100 Subject: Environment: Time of day fixes and add serverside getter -> Put access to time variables under the time lock. -> Merge both time locks, there is no point to have two locks. -> Fix the lock being released too early in Environment::setTimeOfDay -> Add serverside getter so that you don't have to get the environment if you only have the server --- src/environment.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/environment.h') diff --git a/src/environment.h b/src/environment.h index 42faf5f6d..1984cf40d 100644 --- a/src/environment.h +++ b/src/environment.h @@ -104,6 +104,11 @@ public: protected: // peer_ids in here should be unique, except that there may be many 0s std::vector m_players; + + + /* + * Below: values under m_time_lock + */ // Time of day in milli-hours (0-23999); determines day and night u32 m_time_of_day; // Time of day in 0...1 @@ -114,6 +119,9 @@ protected: // Overriding the day-night ratio is useful for custom sky visuals bool m_enable_day_night_ratio_override; u32 m_day_night_ratio_override; + /* + * Above: values under m_time_lock + */ /* TODO: Add a callback function so these can be updated when a setting * changes. At this point in time it doesn't matter (e.g. /set @@ -127,7 +135,6 @@ protected: bool m_cache_enable_shaders; private: - Mutex m_timeofday_lock; Mutex m_time_lock; }; -- cgit v1.2.3