diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-08-10 20:06:03 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-08-10 20:06:03 +0200 |
commit | 42bad0edec58f42e4072360c52870d3be9ced3c5 (patch) | |
tree | 782cd9149c3a0472ec332e2a06c9d8c86e9181d8 /src | |
parent | Added IsDaylightCycleEnabled saving. (diff) | |
download | cuberite-42bad0edec58f42e4072360c52870d3be9ced3c5.tar cuberite-42bad0edec58f42e4072360c52870d3be9ced3c5.tar.gz cuberite-42bad0edec58f42e4072360c52870d3be9ced3c5.tar.bz2 cuberite-42bad0edec58f42e4072360c52870d3be9ced3c5.tar.lz cuberite-42bad0edec58f42e4072360c52870d3be9ced3c5.tar.xz cuberite-42bad0edec58f42e4072360c52870d3be9ced3c5.tar.zst cuberite-42bad0edec58f42e4072360c52870d3be9ced3c5.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/ClientHandle.cpp | 9 | ||||
-rw-r--r-- | src/World.cpp | 7 |
2 files changed, 5 insertions, 11 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 286c17513..37d7edbc1 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -341,15 +341,12 @@ void cClientHandle::Authenticate(const AString & a_Name, const AString & a_UUID, m_Protocol->SendWeather(World->GetWeather()); } - // Send time + // Send time: Int64 TimeOfDay = World->GetTimeOfDay(); if (!World->IsDaylightCycleEnabled()) { - TimeOfDay *= -1; - if (TimeOfDay == 0) - { - TimeOfDay = -1; - } + // When writing a "-" before the number the client ignores it but it will stop the client-side time expiration. + TimeOfDay = std::min(-TimeOfDay, -1); } m_Protocol->SendTimeUpdate(World->GetWorldAge(), TimeOfDay); diff --git a/src/World.cpp b/src/World.cpp index 0ae7f80a6..dcca0519e 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2253,11 +2253,8 @@ void cWorld::BroadcastTimeUpdate(const cClientHandle * a_Exclude) int TimeOfDay = m_TimeOfDay; if (!m_IsDaylightCycleEnabled) { - TimeOfDay *= -1; - if (TimeOfDay == 0) - { - TimeOfDay = -1; - } + // When writing a "-" before the number the client ignores it but it will stop the client-side time expiration. + TimeOfDay = std::min(-TimeOfDay, -1); } cCSLock Lock(m_CSPlayers); |