diff options
author | luksor111@gmail.com <luksor111@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-11-12 12:10:01 +0100 |
---|---|---|
committer | luksor111@gmail.com <luksor111@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-11-12 12:10:01 +0100 |
commit | f32091f98c90e2f9a0786a8865e010880a584e7a (patch) | |
tree | 5380d34dfbfaabe837561de3feafe3749185b1ac /source | |
parent | Added DeadBushes finisher (initial patch by STR_Warrior; DeathBushes FTW!) (diff) | |
download | cuberite-f32091f98c90e2f9a0786a8865e010880a584e7a.tar cuberite-f32091f98c90e2f9a0786a8865e010880a584e7a.tar.gz cuberite-f32091f98c90e2f9a0786a8865e010880a584e7a.tar.bz2 cuberite-f32091f98c90e2f9a0786a8865e010880a584e7a.tar.lz cuberite-f32091f98c90e2f9a0786a8865e010880a584e7a.tar.xz cuberite-f32091f98c90e2f9a0786a8865e010880a584e7a.tar.zst cuberite-f32091f98c90e2f9a0786a8865e010880a584e7a.zip |
Diffstat (limited to 'source')
-rw-r--r-- | source/ClientHandle.cpp | 19 | ||||
-rw-r--r-- | source/ClientHandle.h | 5 |
2 files changed, 20 insertions, 4 deletions
diff --git a/source/ClientHandle.cpp b/source/ClientHandle.cpp index fd7ad917e..d677065a4 100644 --- a/source/ClientHandle.cpp +++ b/source/ClientHandle.cpp @@ -90,6 +90,7 @@ cClientHandle::cClientHandle(const cSocket * a_Socket, int a_ViewDistance) , m_ShouldCheckDownloaded(false) , m_UniqueID(0) , m_BlockDigAnim(-1) + , m_LastDigStatus(-1) { m_Protocol = new cProtocolRecognizer(this); @@ -508,8 +509,8 @@ void cClientHandle::HandleBlockDig(int a_BlockX, int a_BlockY, int a_BlockZ, cha return; } - LOGD("OnBlockDig: {%i, %i, %i}; Face: %i; Stat: %i", - a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_Status + LOGD("OnBlockDig: {%i, %i, %i}; Face: %i; Stat: %i LastStat: %i", + a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_Status, m_LastDigStatus ); // Do we want plugins to disable tossing items? Probably no, so toss item before asking plugins for permission @@ -536,13 +537,23 @@ void cClientHandle::HandleBlockDig(int a_BlockX, int a_BlockY, int a_BlockZ, cha World->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player); return; } - + bool bBroken = ( - (a_Status == DIG_STATUS_FINISHED) || + ((a_Status == DIG_STATUS_FINISHED) && + //Don't allow to finish digging if not started yet: + (m_LastDigStatus == 0) && + (m_LastDigX == a_BlockX) && + (m_LastDigY == a_BlockY) && + (m_LastDigZ == a_BlockZ)) || (g_BlockOneHitDig[(int)OldBlock]) || ((a_Status == DIG_STATUS_STARTED) && (m_Player->GetGameMode() == 1)) ); + m_LastDigStatus = a_Status; + m_LastDigX = a_BlockX; + m_LastDigY = a_BlockY; + m_LastDigZ = a_BlockZ; + if ((a_Status == DIG_STATUS_STARTED) && (m_Player->GetGameMode() != eGameMode_Creative)) { // Start dig animation diff --git a/source/ClientHandle.h b/source/ClientHandle.h index ec79b3b71..cefbbd5d8 100644 --- a/source/ClientHandle.h +++ b/source/ClientHandle.h @@ -223,6 +223,11 @@ private: int m_BlockDigY; int m_BlockDigZ; + char m_LastDigStatus; + int m_LastDigX; + int m_LastDigY; + int m_LastDigZ; + enum eState { csConnected, // The client has just connected, waiting for their handshake / login |