1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

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
This commit is contained in:
est31 2015-10-27 21:03:59 +01:00
parent c406438b95
commit ca8e56c15a
4 changed files with 31 additions and 17 deletions

View file

@ -104,6 +104,11 @@ public:
protected:
// peer_ids in here should be unique, except that there may be many 0s
std::vector<Player*> 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;
};