diff options
author | Mattes D <github@xoft.cz> | 2014-03-09 15:13:27 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-03-09 15:13:27 +0100 |
commit | d3c38c40e4cebd6a69869005fb0863b8d6085949 (patch) | |
tree | 0eae42ee4e07efd5df42029b66cc3faab808265d /src/ClientHandle.cpp | |
parent | Merge pull request #775 from worktycho/warnings (diff) | |
parent | Adjusted style of switch/case (diff) | |
download | cuberite-d3c38c40e4cebd6a69869005fb0863b8d6085949.tar cuberite-d3c38c40e4cebd6a69869005fb0863b8d6085949.tar.gz cuberite-d3c38c40e4cebd6a69869005fb0863b8d6085949.tar.bz2 cuberite-d3c38c40e4cebd6a69869005fb0863b8d6085949.tar.lz cuberite-d3c38c40e4cebd6a69869005fb0863b8d6085949.tar.xz cuberite-d3c38c40e4cebd6a69869005fb0863b8d6085949.tar.zst cuberite-d3c38c40e4cebd6a69869005fb0863b8d6085949.zip |
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r-- | src/ClientHandle.cpp | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 18f93ba2b..b08c029c0 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -1466,7 +1466,7 @@ bool cClientHandle::HandleHandshake(const AString & a_Username) -void cClientHandle::HandleEntityAction(int a_EntityID, char a_ActionID) +void cClientHandle::HandleEntityCrouch(int a_EntityID, bool a_IsCrouching) { if (a_EntityID != m_Player->GetUniqueID()) { @@ -1474,35 +1474,37 @@ void cClientHandle::HandleEntityAction(int a_EntityID, char a_ActionID) return; } - switch (a_ActionID) + m_Player->SetCrouch(a_IsCrouching); +} + + + + + +void cClientHandle::HandleEntityLeaveBed(int a_EntityID) +{ + if (a_EntityID != m_Player->GetUniqueID()) { - case 1: // Crouch - { - m_Player->SetCrouch(true); - break; - } - case 2: // Uncrouch - { - m_Player->SetCrouch(false); - break; - } - case 3: // Leave bed - { - m_Player->GetWorld()->BroadcastEntityAnimation(*m_Player, 2); - break; - } - case 4: // Start sprinting - { - m_Player->SetSprint(true); - break; - } - case 5: // Stop sprinting - { - m_Player->SetSprint(false); - SendPlayerMaxSpeed(); - break; - } + // We should only receive entity actions from the entity that is performing the action + return; } + + m_Player->GetWorld()->BroadcastEntityAnimation(*m_Player, 2); +} + + + + + +void cClientHandle::HandleEntitySprinting(int a_EntityID, bool a_IsSprinting) +{ + if (a_EntityID != m_Player->GetUniqueID()) + { + // We should only receive entity actions from the entity that is performing the action + return; + } + + m_Player->SetSprint(a_IsSprinting); } |