From 403ef6bcdce65a1fd44bd00a0b1c83cee84b7076 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Fri, 26 Oct 2012 08:47:30 +0000 Subject: Fixed a valgrind warning in BlockDirt. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1011 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Blocks/BlockDirt.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source/Blocks') 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); -- cgit v1.2.3