diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-11-01 22:38:20 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-11-01 22:38:20 +0100 |
commit | 4cebaa99f88e25e039416354cf490fe98642af7e (patch) | |
tree | 40f8b0cc061e3ec55539e30754df3e3d1c17dd80 /source/ClientHandle.cpp | |
parent | Added Bats and Witches. (diff) | |
download | cuberite-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 '')
-rw-r--r-- | source/ClientHandle.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/source/ClientHandle.cpp b/source/ClientHandle.cpp index a6e025f8c..24654d303 100644 --- a/source/ClientHandle.cpp +++ b/source/ClientHandle.cpp @@ -81,7 +81,7 @@ cClientHandle::cClientHandle(const cSocket * a_Socket, int a_ViewDistance) , m_bDestroyed(false) , m_Player(NULL) , m_bKicking(false) - , m_TimeLastPacket(cWorld::GetTime()) + , m_TimeSinceLastPacket(0) , m_bKeepThreadGoing(true) , m_Ping(1000) , m_PingID(1) @@ -244,7 +244,7 @@ void cClientHandle::Authenticate(void) } // Send time - m_Protocol->SendTimeUpdate(World->GetWorldTime()); + m_Protocol->SendTimeUpdate(World->GetWorldAge(), World->GetTimeOfDay()); // Send inventory m_Player->GetInventory().SendWholeInventory(*this); @@ -1049,6 +1049,8 @@ bool cClientHandle::CheckBlockInteractionsRate(void) { ASSERT(m_Player != NULL); ASSERT(m_Player->GetWorld() != NULL); + /* + // TODO: _X 2012_11_01: This needs a total re-thinking and rewriting int LastActionCnt = m_Player->GetLastBlockActionCnt(); if ((m_Player->GetWorld()->GetTime() - m_Player->GetLastBlockActionTime()) < 0.1) { @@ -1068,6 +1070,7 @@ bool cClientHandle::CheckBlockInteractionsRate(void) m_Player->SetLastBlockActionCnt(0); // Reset count m_Player->SetLastBlockActionTime(); // Player tried to interact with a block. Reset last block interation time. } + */ return true; } @@ -1077,8 +1080,8 @@ bool cClientHandle::CheckBlockInteractionsRate(void) void cClientHandle::Tick(float a_Dt) { - (void)a_Dt; - if (cWorld::GetTime() - m_TimeLastPacket > 30.f) // 30 seconds time-out + m_TimeSinceLastPacket += a_Dt; + if (m_TimeSinceLastPacket > 30000.f) // 30 seconds time-out { SendDisconnect("Nooooo!! You timed out! D: Come back!"); Destroy(); @@ -1459,9 +1462,9 @@ void cClientHandle::SendWeather(eWeather a_Weather) -void cClientHandle::SendTimeUpdate(Int64 a_WorldTime) +void cClientHandle::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay) { - m_Protocol->SendTimeUpdate(a_WorldTime); + m_Protocol->SendTimeUpdate(a_WorldAge, a_TimeOfDay); } @@ -1704,7 +1707,7 @@ void cClientHandle::DataReceived(const char * a_Data, int a_Size) { // Data is received from the client, hand it off to the protocol: m_Protocol->DataReceived(a_Data, a_Size); - m_TimeLastPacket = cWorld::GetTime(); + m_TimeSinceLastPacket = 0; } |