summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2017-06-08 19:27:24 +0200
committerLukas Pioch <lukas@zgow.de>2017-06-09 13:44:06 +0200
commit9c08b4524cb4c612bcd96a0cccdd6907d3bee74b (patch)
tree1dc7d4339122630eea1f6e6e07de99392d13ad15 /src/ClientHandle.cpp
parentFixed skylight going down through transparent blocks. (diff)
downloadcuberite-9c08b4524cb4c612bcd96a0cccdd6907d3bee74b.tar
cuberite-9c08b4524cb4c612bcd96a0cccdd6907d3bee74b.tar.gz
cuberite-9c08b4524cb4c612bcd96a0cccdd6907d3bee74b.tar.bz2
cuberite-9c08b4524cb4c612bcd96a0cccdd6907d3bee74b.tar.lz
cuberite-9c08b4524cb4c612bcd96a0cccdd6907d3bee74b.tar.xz
cuberite-9c08b4524cb4c612bcd96a0cccdd6907d3bee74b.tar.zst
cuberite-9c08b4524cb4c612bcd96a0cccdd6907d3bee74b.zip
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index efd592405..fe85ddfb8 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -1050,12 +1050,10 @@ void cClientHandle::HandleLeftClick(int a_BlockX, int a_BlockY, int a_BlockZ, eB
int BlockZ = a_BlockZ;
AddFaceDirection(BlockX, BlockY, BlockZ, a_BlockFace);
- if ((BlockY < 0) || (BlockY >= cChunkDef::Height))
- {
- return;
- }
-
- if (cBlockInfo::GetHandler(m_Player->GetWorld()->GetBlock(BlockX, BlockY, BlockZ))->IsClickedThrough())
+ if (
+ cChunkDef::IsValidHeight(BlockY) &&
+ cBlockInfo::GetHandler(m_Player->GetWorld()->GetBlock(BlockX, BlockY, BlockZ))->IsClickedThrough()
+ )
{
a_BlockX = BlockX;
a_BlockY = BlockY;
@@ -1385,12 +1383,15 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, e
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
if ((a_BlockX != -1) && (a_BlockY >= 0) && (a_BlockZ != -1))
{
- World->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player);
- if (a_BlockY < cChunkDef::Height - 1)
+ if (cChunkDef::IsValidHeight(a_BlockY))
+ {
+ World->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player);
+ }
+ if (cChunkDef::IsValidHeight(a_BlockY + 1))
{
World->SendBlockTo(a_BlockX, a_BlockY + 1, a_BlockZ, m_Player); // 2 block high things
}
- if (a_BlockY > 0)
+ if (cChunkDef::IsValidHeight(a_BlockY - 1))
{
World->SendBlockTo(a_BlockX, a_BlockY - 1, a_BlockZ, m_Player); // 2 block high things
}
@@ -1418,12 +1419,15 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, e
if (a_BlockFace != BLOCK_FACE_NONE)
{
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
- World->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player);
- if (a_BlockY < cChunkDef::Height - 1)
+ if (cChunkDef::IsValidHeight(a_BlockY))
+ {
+ World->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player);
+ }
+ if (cChunkDef::IsValidHeight(a_BlockY + 1))
{
World->SendBlockTo(a_BlockX, a_BlockY + 1, a_BlockZ, m_Player); // 2 block high things
}
- if (a_BlockY > 1)
+ if (cChunkDef::IsValidHeight(a_BlockY - 1))
{
World->SendBlockTo(a_BlockX, a_BlockY - 1, a_BlockZ, m_Player); // 2 block high things
}