From 2c945c8818a19405c566be1fcb6367a69b0a60c8 Mon Sep 17 00:00:00 2001 From: Tycho Date: Mon, 8 Sep 2014 19:07:45 +0100 Subject: [PATCH] TimeOfDay does not need to be an Int64 --- src/Blocks/WorldInterface.h | 4 ++-- src/World.cpp | 2 +- src/World.h | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h index d1c6f9bfc..b43d011d8 100644 --- a/src/Blocks/WorldInterface.h +++ b/src/Blocks/WorldInterface.h @@ -17,7 +17,7 @@ class cWorldInterface public: virtual ~cWorldInterface() {} - virtual Int64 GetTimeOfDay(void) const = 0; + virtual int GetTimeOfDay(void) const = 0; virtual Int64 GetWorldAge(void) const = 0; virtual eDimension GetDimension(void) const = 0; @@ -44,7 +44,7 @@ public: /** Calls the callback for each player in the list; returns true if all players processed, false if the callback aborted by returning true */ virtual bool ForEachPlayer(cItemCallback & a_Callback) = 0; - virtual void SetTimeOfDay(Int64 a_TimeOfDay) = 0; + virtual void SetTimeOfDay(int a_TimeOfDay) = 0; /** Returns true if it is raining, stormy or snowing at the specified location. This takes into account biomes. */ virtual bool IsWeatherWetAt(int a_BlockX, int a_BlockZ) = 0; diff --git a/src/World.cpp b/src/World.cpp index 319d5851f..e6f967a1b 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -876,7 +876,7 @@ void cWorld::Tick(float a_Dt, int a_LastTickDurationMSec) m_TimeOfDaySecs -= 1200.0; } - m_TimeOfDay = (Int64)(m_TimeOfDaySecs * 20.0); + m_TimeOfDay = static_cast(m_TimeOfDaySecs * 20.0); // Updates the sky darkness based on current time of day UpdateSkyDarkness(); diff --git a/src/World.h b/src/World.h index 6316c6811..274bd2dcf 100644 --- a/src/World.h +++ b/src/World.h @@ -157,14 +157,14 @@ public: } virtual Int64 GetWorldAge (void) const override { return m_WorldAge; } - virtual Int64 GetTimeOfDay(void) const override { return m_TimeOfDay; } + virtual int GetTimeOfDay(void) const override { return m_TimeOfDay; } void SetTicksUntilWeatherChange(int a_WeatherInterval) { m_WeatherInterval = a_WeatherInterval; } - virtual void SetTimeOfDay(Int64 a_TimeOfDay) override + virtual void SetTimeOfDay(int a_TimeOfDay) override { m_TimeOfDay = a_TimeOfDay; m_TimeOfDaySecs = (double)a_TimeOfDay / 20.0; @@ -888,7 +888,7 @@ private: double m_WorldAgeSecs; // World age, in seconds. Is only incremented, cannot be set by plugins. double m_TimeOfDaySecs; // Time of day in seconds. Can be adjusted. Is wrapped to zero each day. Int64 m_WorldAge; // World age in ticks, calculated off of m_WorldAgeSecs - Int64 m_TimeOfDay; // Time in ticks, calculated off of m_TimeOfDaySecs + int m_TimeOfDay; // Time in ticks, calculated off of m_TimeOfDaySecs Int64 m_LastTimeUpdate; // The tick in which the last time update has been sent. Int64 m_LastUnload; // The last WorldAge (in ticks) in which unloading was triggerred Int64 m_LastSave; // The last WorldAge (in ticks) in which save-all was triggerred