From 641a1286c1e35de24ce22f74dd4566ab3a6ec1d6 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 8 Sep 2013 22:40:50 +0200 Subject: Fixed torch placement. This is related to #127, but until we know more about the change, I'm not closing the issue. --- source/Blocks/BlockTorch.h | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'source') diff --git a/source/Blocks/BlockTorch.h b/source/Blocks/BlockTorch.h index 3a50cab77..6e43453bf 100644 --- a/source/Blocks/BlockTorch.h +++ b/source/Blocks/BlockTorch.h @@ -106,13 +106,23 @@ public: } - static bool CanBePlacedOn(BLOCKTYPE a_BlockType, char a_Direction) + static bool CanBePlacedOn(BLOCKTYPE a_BlockType, char a_BlockFace) { - if ( g_BlockIsSolid[a_BlockType] ) { - return (a_Direction == 0x1); // allow only direction "standing on floor" - } - else { - return g_BlockIsSolid[a_BlockType]; + switch (a_BlockType) + { + case E_BLOCK_GLASS: + case E_BLOCK_FENCE: + case E_BLOCK_NETHER_BRICK_FENCE: + case E_BLOCK_PISTON: + case E_BLOCK_WORKBENCH: + { + return (a_BlockFace == BLOCK_FACE_TOP); // allow only direction "standing on floor" on these blocks + } + + default: + { + return g_BlockIsSolid[a_BlockType]; // Any placement on solid blocks + } } } @@ -121,7 +131,7 @@ public: { // TODO: If placing a torch from below, check all 4 XZ neighbors, place it on that neighbor instead // How to propagate that change up? - // Simon: The easiest way is to calculate the position two times, shouldn�t cost much cpu power :) + // Simon: The easiest way is to calculate the position two times, shouldn't cost much cpu power :) if (a_BlockFace == BLOCK_FACE_BOTTOM) { -- cgit v1.2.3