summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-11-30 14:22:26 +0100
committermadmaxoft <github@xoft.cz>2013-11-30 14:22:26 +0100
commit2383016b1d673fcf0ad69a08bba62d7ce36cdd76 (patch)
tree97bc44cd3d747b3cbe5a2794419c17eb7c177ba0 /src/World.cpp
parentGrass doesn't spread to podzol or grassless dirt blocks. (diff)
downloadcuberite-2383016b1d673fcf0ad69a08bba62d7ce36cdd76.tar
cuberite-2383016b1d673fcf0ad69a08bba62d7ce36cdd76.tar.gz
cuberite-2383016b1d673fcf0ad69a08bba62d7ce36cdd76.tar.bz2
cuberite-2383016b1d673fcf0ad69a08bba62d7ce36cdd76.tar.lz
cuberite-2383016b1d673fcf0ad69a08bba62d7ce36cdd76.tar.xz
cuberite-2383016b1d673fcf0ad69a08bba62d7ce36cdd76.tar.zst
cuberite-2383016b1d673fcf0ad69a08bba62d7ce36cdd76.zip
Diffstat (limited to 'src/World.cpp')
-rw-r--r--src/World.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 8ef4dc0f3..03efbdf32 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -197,20 +197,21 @@ void cWorld::cTickThread::Execute(void)
{
cTimer Timer;
- long long msPerTick = 50;
- long long LastTime = Timer.GetNowTime();
+ const Int64 msPerTick = 50;
+ Int64 LastTime = Timer.GetNowTime();
+ Int64 TickDuration = 50;
while (!m_ShouldTerminate)
{
- long long NowTime = Timer.GetNowTime();
+ Int64 NowTime = Timer.GetNowTime();
float DeltaTime = (float)(NowTime - LastTime);
- m_World.Tick(DeltaTime);
- long long TickTime = Timer.GetNowTime() - NowTime;
+ m_World.Tick(DeltaTime, (int)TickDuration);
+ TickDuration = Timer.GetNowTime() - NowTime;
- if (TickTime < msPerTick)
+ if (TickDuration < msPerTick)
{
// Stretch tick time until it's at least msPerTick
- cSleep::MilliSleep((unsigned int)(msPerTick - TickTime));
+ cSleep::MilliSleep((unsigned int)(msPerTick - TickDuration));
}
LastTime = NowTime;
@@ -660,10 +661,10 @@ void cWorld::Stop(void)
-void cWorld::Tick(float a_Dt)
+void cWorld::Tick(float a_Dt, int a_LastTickDurationMSec)
{
// Call the plugins
- cPluginManager::Get()->CallHookWorldTick(*this, a_Dt);
+ cPluginManager::Get()->CallHookWorldTick(*this, a_Dt, a_LastTickDurationMSec);
// We need sub-tick precision here, that's why we store the time in seconds and calculate ticks off of it
m_WorldAgeSecs += (double)a_Dt / 1000.0;