summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-02-28 15:26:32 +0100
committerHowaner <franzi.moos@googlemail.com>2014-02-28 15:26:32 +0100
commit66c84250410bf24bc689436c570c284bc47e3638 (patch)
treeb0d9de1efb603c55c041505f6c12b7d5b092a846
parentFixed crash and some warnings in map handling. (diff)
downloadcuberite-66c84250410bf24bc689436c570c284bc47e3638.tar
cuberite-66c84250410bf24bc689436c570c284bc47e3638.tar.gz
cuberite-66c84250410bf24bc689436c570c284bc47e3638.tar.bz2
cuberite-66c84250410bf24bc689436c570c284bc47e3638.tar.lz
cuberite-66c84250410bf24bc689436c570c284bc47e3638.tar.xz
cuberite-66c84250410bf24bc689436c570c284bc47e3638.tar.zst
cuberite-66c84250410bf24bc689436c570c284bc47e3638.zip
-rw-r--r--src/Blocks/BlockSlab.h35
-rw-r--r--src/ClientHandle.cpp2
-rw-r--r--src/Simulator/FireSimulator.cpp13
3 files changed, 37 insertions, 13 deletions
diff --git a/src/Blocks/BlockSlab.h b/src/Blocks/BlockSlab.h
index 3628303ce..8a3c998ec 100644
--- a/src/Blocks/BlockSlab.h
+++ b/src/Blocks/BlockSlab.h
@@ -28,7 +28,7 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
- a_Pickups.push_back(cItem(m_BlockType, 1, a_BlockMeta));
+ a_Pickups.push_back(cItem(m_BlockType, 1, a_BlockMeta & 0x7));
}
@@ -41,7 +41,7 @@ public:
{
a_BlockType = m_BlockType;
BLOCKTYPE Type = (BLOCKTYPE) (a_Player->GetEquippedItem().m_ItemType);
- NIBBLETYPE Meta = (NIBBLETYPE)(a_Player->GetEquippedItem().m_ItemDamage & 0x07);
+ NIBBLETYPE Meta = (NIBBLETYPE) a_Player->GetEquippedItem().m_ItemDamage;
// HandlePlaceBlock wants a cItemHandler pointer thing, so let's give it one
cItemHandler * ItemHandler = cItemHandler::GetItemHandler(GetDoubleSlabType(Type));
@@ -159,21 +159,32 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
- if (m_BlockType == E_BLOCK_DOUBLE_STONE_SLAB)
- {
- m_BlockType = E_BLOCK_STONE_SLAB;
- }
- else
+ BLOCKTYPE Block = GetSingleSlabType(m_BlockType);
+ a_Pickups.push_back(cItem(Block, 2, a_BlockMeta & 0x7));
+ }
+
+ inline static BLOCKTYPE GetSingleSlabType(BLOCKTYPE a_BlockType)
+ {
+ switch (a_BlockType)
{
- m_BlockType = E_BLOCK_WOODEN_SLAB;
+ case E_BLOCK_DOUBLE_STONE_SLAB: return E_BLOCK_STONE_SLAB;
+ case E_BLOCK_DOUBLE_WOODEN_SLAB: return E_BLOCK_WOODEN_SLAB;
}
- a_Pickups.push_back(cItem(m_BlockType, 2, a_BlockMeta));
+ ASSERT(!"Unhandled double slab type!");
+ return a_BlockType;
}
-
virtual const char * GetStepSound(void) override
- {
- return ((m_BlockType == E_BLOCK_DOUBLE_WOODEN_SLAB) || (m_BlockType == E_BLOCK_DOUBLE_WOODEN_SLAB)) ? "step.wood" : "step.stone";
+ {
+ BLOCKTYPE Block = GetSingleSlabType(m_BlockType);
+ if (Block != m_BlockType)
+ {
+ return cBlockHandler::GetBlockHandler(Block)->GetStepSound();
+ }
+ else
+ {
+ return "step.stone";
+ }
}
} ;
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index b08ceb5f6..ce549b0b1 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -1043,7 +1043,7 @@ void cClientHandle::HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, e
if (
cBlockSlabHandler::IsAnySlabType(ClickedBlock) && // Is there a slab already?
cBlockSlabHandler::IsAnySlabType(EquippedBlock) && // Is the player placing another slab?
- ((ClickedBlockMeta & 0x07) == (EquippedBlockDamage & 0x07)) && // Is it the same slab type?
+ ((ClickedBlockMeta & 0x07) == EquippedBlockDamage) && // Is it the same slab type?
(
(a_BlockFace == BLOCK_FACE_TOP) || // Clicking the top of a bottom slab
(a_BlockFace == BLOCK_FACE_BOTTOM) // Clicking the bottom of a top slab
diff --git a/src/Simulator/FireSimulator.cpp b/src/Simulator/FireSimulator.cpp
index b77fa1658..85190c82b 100644
--- a/src/Simulator/FireSimulator.cpp
+++ b/src/Simulator/FireSimulator.cpp
@@ -162,14 +162,27 @@ bool cFireSimulator::IsFuel(BLOCKTYPE a_BlockType)
switch (a_BlockType)
{
case E_BLOCK_PLANKS:
+ case E_BLOCK_DOUBLE_WOODEN_SLAB:
+ case E_BLOCK_WOODEN_SLAB:
+ case E_BLOCK_WOODEN_STAIRS:
+ case E_BLOCK_SPRUCE_WOOD_STAIRS:
+ case E_BLOCK_BIRCH_WOOD_STAIRS:
+ case E_BLOCK_JUNGLE_WOOD_STAIRS:
case E_BLOCK_LEAVES:
+ case E_BLOCK_NEW_LEAVES:
case E_BLOCK_LOG:
+ case E_BLOCK_NEW_LOG:
case E_BLOCK_WOOL:
case E_BLOCK_BOOKCASE:
case E_BLOCK_FENCE:
case E_BLOCK_TNT:
case E_BLOCK_VINES:
case E_BLOCK_HAY_BALE:
+ case E_BLOCK_TALL_GRASS:
+ case E_BLOCK_BIG_FLOWER:
+ case E_BLOCK_DANDELION:
+ case E_BLOCK_FLOWER:
+ case E_BLOCK_CARPET:
{
return true;
}