1
0
Fork 0

Fixed a compiler warning.

Also updated code to match our style.
This commit is contained in:
madmaxoft 2013-10-30 23:33:42 +01:00
parent 8b9d3c7722
commit f490d3d1e7
1 changed files with 31 additions and 26 deletions

View File

@ -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;
}