diff options
author | Alexander Harkness <me@bearbin.net> | 2017-09-10 18:45:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-10 18:45:18 +0200 |
commit | 4e7325c9e237bfa8626cdd7f7b7533328acb583d (patch) | |
tree | ea80dca94613adee6197fa735ace695c14ebfd83 /src/Entities | |
parent | Shutdown connection when disconnect packet sent (#3999) (diff) | |
download | cuberite-4e7325c9e237bfa8626cdd7f7b7533328acb583d.tar cuberite-4e7325c9e237bfa8626cdd7f7b7533328acb583d.tar.gz cuberite-4e7325c9e237bfa8626cdd7f7b7533328acb583d.tar.bz2 cuberite-4e7325c9e237bfa8626cdd7f7b7533328acb583d.tar.lz cuberite-4e7325c9e237bfa8626cdd7f7b7533328acb583d.tar.xz cuberite-4e7325c9e237bfa8626cdd7f7b7533328acb583d.tar.zst cuberite-4e7325c9e237bfa8626cdd7f7b7533328acb583d.zip |
Diffstat (limited to 'src/Entities')
-rw-r--r-- | src/Entities/Entity.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 33f5a6135..ba75f0443 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -1662,7 +1662,9 @@ bool cEntity::MoveToWorld(const AString & a_WorldName, bool a_ShouldSendRespawn) void cEntity::SetSwimState(cChunk & a_Chunk) { int RelY = FloorC(GetPosY() + 0.1); - if ((RelY < 0) || (RelY >= cChunkDef::Height - 1)) + int HeadRelY = CeilC(GetPosY() + GetHeight()) - 1; + ASSERT(RelY <= HeadRelY); + if ((RelY < 0) || (HeadRelY >= cChunkDef::Height)) { m_IsSwimming = false; m_IsSubmerged = false; @@ -1688,8 +1690,7 @@ void cEntity::SetSwimState(cChunk & a_Chunk) m_IsSwimming = IsBlockWater(BlockIn); // Check if the player is submerged: - int HeadHeight = CeilC(GetPosY() + GetHeight()) - 1; - VERIFY(a_Chunk.UnboundedRelGetBlockType(RelX, HeadHeight, RelZ, BlockIn)); + VERIFY(a_Chunk.UnboundedRelGetBlockType(RelX, HeadRelY, RelZ, BlockIn)); m_IsSubmerged = IsBlockWater(BlockIn); } |