diff options
author | madmaxoft <github@xoft.cz> | 2013-09-08 22:40:50 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2013-09-08 22:40:50 +0200 |
commit | 641a1286c1e35de24ce22f74dd4566ab3a6ec1d6 (patch) | |
tree | 9ce2ce246e16d69e762ddae16b7df550cdd74f4e /source | |
parent | Alpha-sorted g_BlockIsSnowable[]. (diff) | |
download | cuberite-641a1286c1e35de24ce22f74dd4566ab3a6ec1d6.tar cuberite-641a1286c1e35de24ce22f74dd4566ab3a6ec1d6.tar.gz cuberite-641a1286c1e35de24ce22f74dd4566ab3a6ec1d6.tar.bz2 cuberite-641a1286c1e35de24ce22f74dd4566ab3a6ec1d6.tar.lz cuberite-641a1286c1e35de24ce22f74dd4566ab3a6ec1d6.tar.xz cuberite-641a1286c1e35de24ce22f74dd4566ab3a6ec1d6.tar.zst cuberite-641a1286c1e35de24ce22f74dd4566ab3a6ec1d6.zip |
Diffstat (limited to 'source')
-rw-r--r-- | source/Blocks/BlockTorch.h | 24 |
1 files changed, 17 insertions, 7 deletions
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) { |