summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemBoat.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-08-19 15:53:54 +0200
committerGitHub <noreply@github.com>2016-08-19 15:53:54 +0200
commitc61746a39238ec0b180635d914091d82fe8e8dfc (patch)
tree4bf43680b38b96c1286f5aed5c4dba73f078b857 /src/Items/ItemBoat.h
parentRemoved Decoda project files, no longer used. (#3320) (diff)
parentFixed implicit rounding warnings. (diff)
downloadcuberite-c61746a39238ec0b180635d914091d82fe8e8dfc.tar
cuberite-c61746a39238ec0b180635d914091d82fe8e8dfc.tar.gz
cuberite-c61746a39238ec0b180635d914091d82fe8e8dfc.tar.bz2
cuberite-c61746a39238ec0b180635d914091d82fe8e8dfc.tar.lz
cuberite-c61746a39238ec0b180635d914091d82fe8e8dfc.tar.xz
cuberite-c61746a39238ec0b180635d914091d82fe8e8dfc.tar.zst
cuberite-c61746a39238ec0b180635d914091d82fe8e8dfc.zip
Diffstat (limited to 'src/Items/ItemBoat.h')
-rw-r--r--src/Items/ItemBoat.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/Items/ItemBoat.h b/src/Items/ItemBoat.h
index de16c70dc..5f7f91b57 100644
--- a/src/Items/ItemBoat.h
+++ b/src/Items/ItemBoat.h
@@ -73,19 +73,22 @@ public:
return false;
}
- double x = Callbacks.m_Pos.x;
- double y = Callbacks.m_Pos.y;
- double z = Callbacks.m_Pos.z;
+ auto x = Callbacks.m_Pos.x;
+ auto y = Callbacks.m_Pos.y;
+ auto z = Callbacks.m_Pos.z;
+ auto bx = FloorC(x);
+ auto by = FloorC(y);
+ auto bz = FloorC(z);
// Verify that block type for spawn point is water
- BLOCKTYPE SpawnBlock = a_World->GetBlock(x, y, z);
+ BLOCKTYPE SpawnBlock = a_World->GetBlock(bx, by, bz);
if (!IsBlockWater(SpawnBlock))
{
return false;
}
// Block above must be air to spawn a boat (prevents spawning a boat underwater)
- BLOCKTYPE BlockAbove = a_World->GetBlock(x, y + 1, z);
+ BLOCKTYPE BlockAbove = a_World->GetBlock(bx, by + 1, bz);
if (BlockAbove != E_BLOCK_AIR)
{
return false;