summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mobs/Monster.cpp')
-rw-r--r--src/Mobs/Monster.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 84f58ff85..dc950ff7d 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -261,11 +261,11 @@ void cMonster::MoveToWayPoint(cChunk & a_Chunk)
bool cMonster::EnsureProperDestination(cChunk & a_Chunk)
{
- cChunk * Chunk = a_Chunk.GetNeighborChunk(m_FinalDestination.x, m_FinalDestination.z);
+ cChunk * Chunk = a_Chunk.GetNeighborChunk(FloorC(m_FinalDestination.x), FloorC(m_FinalDestination.z));
BLOCKTYPE BlockType;
NIBBLETYPE BlockMeta;
- int RelX = m_FinalDestination.x - Chunk->GetPosX() * cChunkDef::Width;
- int RelZ = m_FinalDestination.z - Chunk->GetPosZ() * cChunkDef::Width;
+ int RelX = FloorC(m_FinalDestination.x) - Chunk->GetPosX() * cChunkDef::Width;
+ int RelZ = FloorC(m_FinalDestination.z) - Chunk->GetPosZ() * cChunkDef::Width;
if ((Chunk == nullptr) || !Chunk->IsValid())
{
return false;
@@ -274,7 +274,7 @@ bool cMonster::EnsureProperDestination(cChunk & a_Chunk)
// If destination in the air, go down to the lowest air block.
while (m_FinalDestination.y > 0)
{
- Chunk->GetBlockTypeMeta(RelX, m_FinalDestination.y - 1, RelZ, BlockType, BlockMeta);
+ Chunk->GetBlockTypeMeta(RelX, FloorC(m_FinalDestination.y) - 1, RelZ, BlockType, BlockMeta);
if (cBlockInfo::IsSolid(BlockType))
{
break;
@@ -288,7 +288,7 @@ bool cMonster::EnsureProperDestination(cChunk & a_Chunk)
bool InWater = false;
while (m_FinalDestination.y < cChunkDef::Height)
{
- Chunk->GetBlockTypeMeta(RelX, m_FinalDestination.y, RelZ, BlockType, BlockMeta);
+ Chunk->GetBlockTypeMeta(RelX, FloorC(m_FinalDestination.y), RelZ, BlockType, BlockMeta);
if (BlockType == E_BLOCK_STATIONARY_WATER)
{
InWater = true;