From 7549f468b396325be0094495a80cb5f4ec3efdf0 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Fri, 19 Aug 2016 14:09:10 +0200 Subject: Fixed implicit rounding warnings. --- src/Items/ItemBoat.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/Items') 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; -- cgit v1.2.3