summaryrefslogtreecommitdiffstats
path: root/source/World.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-11-01 22:38:20 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-11-01 22:38:20 +0100
commit4cebaa99f88e25e039416354cf490fe98642af7e (patch)
tree40f8b0cc061e3ec55539e30754df3e3d1c17dd80 /source/World.h
parentAdded Bats and Witches. (diff)
downloadcuberite-4cebaa99f88e25e039416354cf490fe98642af7e.tar
cuberite-4cebaa99f88e25e039416354cf490fe98642af7e.tar.gz
cuberite-4cebaa99f88e25e039416354cf490fe98642af7e.tar.bz2
cuberite-4cebaa99f88e25e039416354cf490fe98642af7e.tar.lz
cuberite-4cebaa99f88e25e039416354cf490fe98642af7e.tar.xz
cuberite-4cebaa99f88e25e039416354cf490fe98642af7e.tar.zst
cuberite-4cebaa99f88e25e039416354cf490fe98642af7e.zip
Diffstat (limited to 'source/World.h')
-rw-r--r--source/World.h61
1 files changed, 43 insertions, 18 deletions
diff --git a/source/World.h b/source/World.h
index 7d4b68f23..3b5f45276 100644
--- a/source/World.h
+++ b/source/World.h
@@ -59,20 +59,43 @@ public:
OBSOLETE static cWorld * GetWorld();
- // Return time in seconds
- inline static float GetTime() //tolua_export
+ // tolua_begin
+
+ /// Return time in seconds
+ inline static float GetTime(void)
{
- return m_Time;
+ LOGWARNING("cWorld:GetTime() is obsolete, use GetWorldAge() or GetTimeOfDay() for a specific world instead.");
+ return 0;
}
- long long GetWorldTime(void) const { return m_WorldTime; } //tolua_export
-
- eGameMode GetGameMode(void) const { return m_GameMode; } //tolua_export
- bool IsPVPEnabled(void) const { return m_bEnabledPVP; } //tolua_export
+
+ long long GetWorldTime(void) const // OBSOLETE, use GetWorldAge() instead!
+ {
+ LOGWARNING("cWorld:GetWorldTime() is obsolete, use GetWorldAge() or GetTimeOfDay() instead");
+ return m_WorldAge;
+ }
+ Int64 GetWorldAge(void) const { return m_WorldAge; }
+ Int64 GetTimeOfDay(void) const { return m_TimeOfDay; }
+
+ void SetTimeOfDay(Int64 a_TimeOfDay)
+ {
+ m_TimeOfDay = a_TimeOfDay;
+ m_TimeOfDaySecs = (double)a_TimeOfDay / 20.0;
+ BroadcastTimeUpdate();
+ }
+
+ void SetWorldTime(Int64 a_TimeOfDay)
+ {
+ LOGWARNING("cWorld:SetWorldTime() is obsolete, use SetTimeOfDay() instead");
+ SetTimeOfDay(a_TimeOfDay);
+ }
+
+ eGameMode GetGameMode(void) const { return m_GameMode; }
+ bool IsPVPEnabled(void) const { return m_bEnabledPVP; }
bool IsDeepSnowEnabled(void) const { return m_IsDeepSnowEnabled; }
- void SetWorldTime(long long a_WorldTime) { m_WorldTime = a_WorldTime; } //tolua_export
-
- int GetHeight( int a_X, int a_Z ); //tolua_export
+ int GetHeight(int a_BlockX, int a_BlockZ);
+
+ // tolua_end
void BroadcastChat (const AString & a_Message, const cClientHandle * a_Exclude = NULL);
void BroadcastPlayerAnimation (const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude = NULL);
@@ -422,15 +445,18 @@ private:
double m_SpawnY;
double m_SpawnZ;
- float m_LastUnload;
- float m_LastSave;
- static float m_Time; // Time in seconds
- long long m_WorldTime; // Time in seconds*20, this is sent to clients (is wrapped)
- unsigned long long CurrentTick;
+ 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
+ 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
+ Int64 m_LastSpawnMonster; // The last WorldAge (in ticks) in which a monster was spawned
+
eGameMode m_GameMode;
bool m_bEnabledPVP;
bool m_IsDeepSnowEnabled;
- float m_WorldTimeFraction; // When this > 1.f m_WorldTime is incremented by 20
// The cRedstone class simulates redstone and needs access to m_RSList
friend class cRedstone;
@@ -459,8 +485,7 @@ private:
cChunkMap * m_ChunkMap;
bool m_bAnimals;
- float m_SpawnMonsterTime;
- float m_SpawnMonsterRate;
+ Int64 m_SpawnMonsterRate;
eWeather m_Weather;
int m_WeatherInterval;