diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-02-18 01:28:31 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-02-18 01:28:31 +0100 |
commit | ced6eb971d1705330b5a47458a986efb87a8106b (patch) | |
tree | 06c175bdd23d80898c1b3f200da1c4ddeb34eeb2 /src | |
parent | Implemented paintings, fixes #689 (diff) | |
download | cuberite-ced6eb971d1705330b5a47458a986efb87a8106b.tar cuberite-ced6eb971d1705330b5a47458a986efb87a8106b.tar.gz cuberite-ced6eb971d1705330b5a47458a986efb87a8106b.tar.bz2 cuberite-ced6eb971d1705330b5a47458a986efb87a8106b.tar.lz cuberite-ced6eb971d1705330b5a47458a986efb87a8106b.tar.xz cuberite-ced6eb971d1705330b5a47458a986efb87a8106b.tar.zst cuberite-ced6eb971d1705330b5a47458a986efb87a8106b.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/Items/ItemPainting.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/Items/ItemPainting.h b/src/Items/ItemPainting.h index 53fc3809b..b85098221 100644 --- a/src/Items/ItemPainting.h +++ b/src/Items/ItemPainting.h @@ -23,23 +23,26 @@ public: { if (a_Dir == BLOCK_FACE_NONE) { + // Client sends this if clicked on top or bottom face return false; } - AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_Dir); + AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_Dir); // Make sure block that will be occupied is free BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ); - AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_Dir, true); + AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_Dir, true); // We want the clicked block, so go back again if (Block == E_BLOCK_AIR) { int Dir = 0; + + // The client uses different values for painting directions and block faces. Our constants are for the block faces, so we convert them here to painting faces switch (a_Dir) { - case BLOCK_FACE_SOUTH: break; - case BLOCK_FACE_NORTH: Dir = 2; break; - case BLOCK_FACE_WEST: Dir = 1; break; - case BLOCK_FACE_EAST: Dir = 3; break; - default: return false; + case BLOCK_FACE_ZP: break; // Initialised to zero + case BLOCK_FACE_ZM: Dir = 2; break; + case BLOCK_FACE_XM: Dir = 1; break; + case BLOCK_FACE_XP: Dir = 3; break; + default: ASSERT(!"Unhandled block face when trying spawn painting!"); return false; } static const struct // Define all the possible painting titles |