summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSTRWarrior <niels.breuker@hotmail.nl>2013-12-15 15:11:59 +0100
committerSTRWarrior <niels.breuker@hotmail.nl>2013-12-15 15:11:59 +0100
commitffb5a69a9e1e531cb8effc72d2a2ad0a459981e3 (patch)
treef5781bbf67e56ba1bc91ec213812524addbc2e6a /src
parentExported Set and Get functions to Lua. (diff)
downloadcuberite-ffb5a69a9e1e531cb8effc72d2a2ad0a459981e3.tar
cuberite-ffb5a69a9e1e531cb8effc72d2a2ad0a459981e3.tar.gz
cuberite-ffb5a69a9e1e531cb8effc72d2a2ad0a459981e3.tar.bz2
cuberite-ffb5a69a9e1e531cb8effc72d2a2ad0a459981e3.tar.lz
cuberite-ffb5a69a9e1e531cb8effc72d2a2ad0a459981e3.tar.xz
cuberite-ffb5a69a9e1e531cb8effc72d2a2ad0a459981e3.tar.zst
cuberite-ffb5a69a9e1e531cb8effc72d2a2ad0a459981e3.zip
Diffstat (limited to 'src')
-rw-r--r--src/ClientHandle.cpp20
-rw-r--r--src/ClientHandle.h2
-rw-r--r--src/Protocol/Protocol17x.cpp20
3 files changed, 23 insertions, 19 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 68c511d7c..d585eccf1 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -490,24 +490,10 @@ void cClientHandle::HandleCreativeInventory(short a_SlotNum, const cItem & a_Hel
-void cClientHandle::HandlePlayerAbilities(int Flags, float FlyingSpeed, float WalkingSpeed)
+void cClientHandle::HandlePlayerAbilities(bool a_CanFly, bool a_IsFlying, float FlyingSpeed, float WalkingSpeed)
{
- if ((Flags & 2) != 0)
- {
- m_Player->SetFlying(true);
- }
- else
- {
- m_Player->SetFlying(false);
- }
- if ((Flags & 4) != 0)
- {
- m_Player->SetCanFly(true);
- }
- else
- {
- m_Player->SetCanFly(false);
- }
+ m_Player->SetCanFly(a_CanFly);
+ m_Player->SetFlying(a_IsFlying);
}
diff --git a/src/ClientHandle.h b/src/ClientHandle.h
index 51068a319..147a5b2b3 100644
--- a/src/ClientHandle.h
+++ b/src/ClientHandle.h
@@ -176,7 +176,7 @@ public:
void HandleKeepAlive (int a_KeepAliveID);
void HandleLeftClick (int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status);
void HandlePing (void);
- void HandlePlayerAbilities (int Flags, float FlyingSpeed, float WalkingSpeed);
+ void HandlePlayerAbilities (bool a_CanFly, bool a_IsFlying, float FlyingSpeed, float WalkingSpeed);
void HandlePlayerLook (float a_Rotation, float a_Pitch, bool a_IsOnGround);
void HandlePlayerMoveLook (double a_PosX, double a_PosY, double a_PosZ, double a_Stance, float a_Rotation, float a_Pitch, bool a_IsOnGround); // While m_bPositionConfirmed (normal gameplay)
void HandlePlayerPos (double a_PosX, double a_PosY, double a_PosZ, double a_Stance, bool a_IsOnGround);
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index 9b2b19026..edf7d2529 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -1286,7 +1286,25 @@ void cProtocol172::HandlePacketPlayerAbilities(cByteBuffer & a_ByteBuffer)
HANDLE_READ(a_ByteBuffer, ReadByte, Byte, Flags);
HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, FlyingSpeed);
HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, WalkingSpeed);
- m_Client->HandlePlayerAbilities(Flags, FlyingSpeed, WalkingSpeed);
+
+ bool IsFlying, CanFly;
+ if ((Flags & 2) != 0)
+ {
+ IsFlying = true;
+ }
+ else
+ {
+ IsFlying = false;
+ }
+ if ((Flags & 4) != 0)
+ {
+ CanFly = true;
+ }
+ else
+ {
+ CanFly = false;
+ }
+ m_Client->HandlePlayerAbilities(CanFly, IsFlying, FlyingSpeed, WalkingSpeed);
}