diff options
author | Tycho <work.tycho+git@gmail.com> | 2014-03-09 19:02:30 +0100 |
---|---|---|
committer | Tycho <work.tycho+git@gmail.com> | 2014-03-09 19:02:30 +0100 |
commit | b5e33c5424c0b148a7076bb0f3019cfb0ef9c824 (patch) | |
tree | dabb3041abd9b8513570111310903992254d8063 /src/Blocks/BlockTorch.h | |
parent | Fix IsThread destructor (diff) | |
parent | Fixed #778 - stack overflow.com (diff) | |
download | cuberite-b5e33c5424c0b148a7076bb0f3019cfb0ef9c824.tar cuberite-b5e33c5424c0b148a7076bb0f3019cfb0ef9c824.tar.gz cuberite-b5e33c5424c0b148a7076bb0f3019cfb0ef9c824.tar.bz2 cuberite-b5e33c5424c0b148a7076bb0f3019cfb0ef9c824.tar.lz cuberite-b5e33c5424c0b148a7076bb0f3019cfb0ef9c824.tar.xz cuberite-b5e33c5424c0b148a7076bb0f3019cfb0ef9c824.tar.zst cuberite-b5e33c5424c0b148a7076bb0f3019cfb0ef9c824.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Blocks/BlockTorch.h | 67 |
1 files changed, 3 insertions, 64 deletions
diff --git a/src/Blocks/BlockTorch.h b/src/Blocks/BlockTorch.h index 84bbb37ec..d32c77629 100644 --- a/src/Blocks/BlockTorch.h +++ b/src/Blocks/BlockTorch.h @@ -2,17 +2,17 @@ #include "BlockHandler.h" #include "../Chunk.h" - +#include "MetaRotater.h" class cBlockTorchHandler : - public cBlockHandler + public cMetaRotater<cBlockHandler, 0x7, 0x4, 0x1, 0x3, 0x2> { public: cBlockTorchHandler(BLOCKTYPE a_BlockType) - : cBlockHandler(a_BlockType) + : cMetaRotater<cBlockHandler, 0x7, 0x4, 0x1, 0x3, 0x2>(a_BlockType) { } @@ -185,67 +185,6 @@ public: { return "step.wood"; } - - - virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override - { - // Bit 4 stays, the rest is swapped around according to a table: - NIBBLETYPE TopBits = (a_Meta & 0x08); - switch (a_Meta & 0x07) - { - case 0x01: return TopBits | 0x04; // East -> North - case 0x02: return TopBits | 0x03; // West -> South - case 0x03: return TopBits | 0x01; // South -> East - case 0x04: return TopBits | 0x02; // North -> West - default: return a_Meta; // Floor -> Floor - } - } - - - virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) override - { - // Bit 4 stays, the rest is swapped around according to a table: - NIBBLETYPE TopBits = (a_Meta & 0x08); - switch (a_Meta & 0x07) - { - case 0x01: return TopBits | 0x03; // East -> South - case 0x02: return TopBits | 0x04; // West -> North - case 0x03: return TopBits | 0x02; // South -> West - case 0x04: return TopBits | 0x01; // North -> East - default: return a_Meta; // Floor -> Floor - } - } - - - virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) override - { - // Bit 4 stays, the rest is swapped around according to a table: - NIBBLETYPE TopBits = (a_Meta & 0x08); - switch (a_Meta & 0x07) - { - case 0x03: return TopBits | 0x04; // South -> North - case 0x04: return TopBits | 0x03; // North -> South - default: return a_Meta; // Keep the rest - } - } - - - // Mirroring around the XZ plane doesn't make sense for floor torches, - // the others stay the same, so let's keep all the metas the same. - // The base class does tht for us, no need to override MetaMirrorXZ() - - - virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) override - { - // Bit 4 stays, the rest is swapped around according to a table: - NIBBLETYPE TopBits = (a_Meta & 0x08); - switch (a_Meta & 0x07) - { - case 0x01: return TopBits | 0x02; // East -> West - case 0x02: return TopBits | 0x01; // West -> East - default: return a_Meta; // Keep the rest - } - } } ; |