summaryrefslogtreecommitdiffstats
path: root/source/Blocks/BlockDirt.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-26 10:47:30 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-26 10:47:30 +0200
commit403ef6bcdce65a1fd44bd00a0b1c83cee84b7076 (patch)
tree0ec0d77ad89ccd59d0f30b677c5cbd101824a67d /source/Blocks/BlockDirt.h
parentFixed up a few valgrind warnings (diff)
downloadcuberite-403ef6bcdce65a1fd44bd00a0b1c83cee84b7076.tar
cuberite-403ef6bcdce65a1fd44bd00a0b1c83cee84b7076.tar.gz
cuberite-403ef6bcdce65a1fd44bd00a0b1c83cee84b7076.tar.bz2
cuberite-403ef6bcdce65a1fd44bd00a0b1c83cee84b7076.tar.lz
cuberite-403ef6bcdce65a1fd44bd00a0b1c83cee84b7076.tar.xz
cuberite-403ef6bcdce65a1fd44bd00a0b1c83cee84b7076.tar.zst
cuberite-403ef6bcdce65a1fd44bd00a0b1c83cee84b7076.zip
Diffstat (limited to 'source/Blocks/BlockDirt.h')
-rw-r--r--source/Blocks/BlockDirt.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/Blocks/BlockDirt.h b/source/Blocks/BlockDirt.h
index 31d981cb2..9617a47da 100644
--- a/source/Blocks/BlockDirt.h
+++ b/source/Blocks/BlockDirt.h
@@ -51,15 +51,16 @@ public:
BLOCKTYPE DestBlock;
NIBBLETYPE DestMeta;
- a_World->GetBlockTypeMeta(a_BlockX + OfsX, a_BlockY + OfsY, a_BlockZ + OfsZ, DestBlock, DestMeta);
- if(DestBlock != E_BLOCK_DIRT)
+ bool IsValid = a_World->GetBlockTypeMeta(a_BlockX + OfsX, a_BlockY + OfsY, a_BlockZ + OfsZ, DestBlock, DestMeta);
+ if (!IsValid || (DestBlock != E_BLOCK_DIRT))
{
continue;
}
BLOCKTYPE AboveDest;
NIBBLETYPE AboveMeta;
- a_World->GetBlockTypeMeta(a_BlockX + OfsX, a_BlockY + OfsY + 1, a_BlockZ + OfsZ, AboveDest, AboveMeta);
+ IsValid = a_World->GetBlockTypeMeta(a_BlockX + OfsX, a_BlockY + OfsY + 1, a_BlockZ + OfsZ, AboveDest, AboveMeta);
+ ASSERT(IsValid); // WTF - how did we get the DestBlock if AboveBlock is not valid?
if (g_BlockOneHitDig[AboveDest] || g_BlockTransparent[AboveDest])
{
a_World->FastSetBlock(a_BlockX + OfsX, a_BlockY + OfsY, a_BlockZ + OfsZ, E_BLOCK_GRASS, 0);