diff options
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); } |