diff options
author | James Ravenscroft <ravenscroftj@gmail.com> | 2013-08-09 09:37:39 +0200 |
---|---|---|
committer | James Ravenscroft <ravenscroftj@gmail.com> | 2013-08-09 09:37:39 +0200 |
commit | dace1f7bd2e661b4c771322162e9e1b52551dd56 (patch) | |
tree | 9565683fe1b72633336954a49247d9fd6af9931f /source/Player.h | |
parent | Fixed the jump food exhaustion being added when player is swimming (diff) | |
download | cuberite-dace1f7bd2e661b4c771322162e9e1b52551dd56.tar cuberite-dace1f7bd2e661b4c771322162e9e1b52551dd56.tar.gz cuberite-dace1f7bd2e661b4c771322162e9e1b52551dd56.tar.bz2 cuberite-dace1f7bd2e661b4c771322162e9e1b52551dd56.tar.lz cuberite-dace1f7bd2e661b4c771322162e9e1b52551dd56.tar.xz cuberite-dace1f7bd2e661b4c771322162e9e1b52551dd56.tar.zst cuberite-dace1f7bd2e661b4c771322162e9e1b52551dd56.zip |
Diffstat (limited to 'source/Player.h')
-rw-r--r-- | source/Player.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/Player.h b/source/Player.h index 542656b5a..ab9a17cf2 100644 --- a/source/Player.h +++ b/source/Player.h @@ -260,6 +260,12 @@ public: virtual bool IsSprinting(void) const { return m_IsSprinting; } virtual bool IsRclking (void) const { return IsEating(); } + /// Returns whether the player is swimming or not + virtual bool IsSwimming(void) const{ return m_IsSwimming; } + + /// Return whether the player is under water or not + virtual bool IsSubmerged(void) const{ return m_IsSubmerged; } + protected: typedef std::map< std::string, bool > PermissionMap; PermissionMap m_ResolvedPermissions; @@ -335,6 +341,9 @@ protected: bool m_IsCrouched; bool m_IsSprinting; + bool m_IsSwimming; + bool m_IsSubmerged; + /// The world tick in which eating will be finished. -1 if not eating Int64 m_EatingFinishTick; @@ -347,7 +356,10 @@ protected: void HandleFood(void); /// Called in each tick to handle air-related processing i.e. drowning - void HandleAir(cChunk & a_Chunk); + void HandleAir(); + + /// Called once per tick to set IsSwimming and IsSubmerged + void SetSwimState(cChunk & a_Chunk); /// Adds food exhaustion based on the difference between Pos and LastPos, sprinting status and swimming (in water block) void ApplyFoodExhaustionFromMovement(cChunk & a_Chunk); |