summaryrefslogtreecommitdiffstats
path: root/source/World.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/World.cpp')
-rw-r--r--source/World.cpp57
1 files changed, 31 insertions, 26 deletions
diff --git a/source/World.cpp b/source/World.cpp
index ad34dc6a5..dd3965e3d 100644
--- a/source/World.cpp
+++ b/source/World.cpp
@@ -55,6 +55,12 @@
/// Up to this many m_SpreadQueue elements are handled each world tick
const int MAX_LIGHTING_SPREAD_PER_TICK = 10;
+const int TIME_SUNSET = 12000;
+const int TIME_NIGHT_START = 13187;
+const int TIME_NIGHT_END = 22812;
+const int TIME_SUNRISE = 23999;
+const int TIME_SPAWN_DIVISOR = 148;
+
@@ -872,6 +878,31 @@ void cWorld::TickClients(float a_Dt)
+void cWorld::UpdateSkyDarkness(void)
+{
+ int TempTime = (int)m_TimeOfDay;
+ if (TempTime <= TIME_SUNSET)
+ {
+ m_SkyDarkness = 0;
+ }
+ else if (TempTime <= TIME_NIGHT_START)
+ {
+ m_SkyDarkness = (TIME_NIGHT_START - TempTime) / TIME_SPAWN_DIVISOR;
+ }
+ else if (TempTime <= TIME_NIGHT_END)
+ {
+ m_SkyDarkness = 8;
+ }
+ else
+ {
+ m_SkyDarkness = (TIME_SUNRISE - TempTime) / TIME_SPAWN_DIVISOR;
+ }
+}
+
+
+
+
+
void cWorld::WakeUpSimulators(int a_BlockX, int a_BlockY, int a_BlockZ)
{
return m_ChunkMap->WakeUpSimulators(a_BlockX, a_BlockY, a_BlockZ);
@@ -2681,29 +2712,3 @@ void cWorld::cTaskSaveAllChunks::Run(cWorld & a_World)
-#define TIME_SUNSET 12000
-#define TIME_NIGHT_START 13187
-#define TIME_NIGHT_END 22812
-#define TIME_SUNRISE 23999
-#define TIME_SPAWN_DIVIZOR 148
-
-
-
-
-
-void cWorld::UpdateSkyDarkness()
-{
- int TempTime = m_TimeOfDay;
- if (TempTime <= TIME_SUNSET)
- m_SkyDarkness = 0;
- else if (TempTime <= TIME_NIGHT_START)
- m_SkyDarkness = (TIME_NIGHT_START - TempTime)/TIME_SPAWN_DIVIZOR;
- else if (TempTime <= TIME_NIGHT_END)
- m_SkyDarkness = 8;
- else
- m_SkyDarkness = (TIME_SUNRISE - TempTime)/TIME_SPAWN_DIVIZOR;
-}
-
-
-
-