summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-10-30 23:33:42 +0100
committermadmaxoft <github@xoft.cz>2013-10-30 23:33:42 +0100
commitf490d3d1e71195cdb87285a63377eadfaa3b6e8b (patch)
tree2753293bff08a0d82600df78c684d550eed6a990 /source
parentMerge pull request #292 from SamJBarney/MobSpawning (diff)
downloadcuberite-f490d3d1e71195cdb87285a63377eadfaa3b6e8b.tar
cuberite-f490d3d1e71195cdb87285a63377eadfaa3b6e8b.tar.gz
cuberite-f490d3d1e71195cdb87285a63377eadfaa3b6e8b.tar.bz2
cuberite-f490d3d1e71195cdb87285a63377eadfaa3b6e8b.tar.lz
cuberite-f490d3d1e71195cdb87285a63377eadfaa3b6e8b.tar.xz
cuberite-f490d3d1e71195cdb87285a63377eadfaa3b6e8b.tar.zst
cuberite-f490d3d1e71195cdb87285a63377eadfaa3b6e8b.zip
Diffstat (limited to 'source')
-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;
-}
-
-
-
-