summaryrefslogtreecommitdiffstats
path: root/src/Blocks
diff options
context:
space:
mode:
Diffstat (limited to 'src/Blocks')
-rw-r--r--src/Blocks/BlockAnvil.h8
-rw-r--r--src/Blocks/BlockBed.h2
-rw-r--r--src/Blocks/BlockButton.h2
-rw-r--r--src/Blocks/BlockCocoaPod.h4
-rw-r--r--src/Blocks/BlockDoor.h6
-rw-r--r--src/Blocks/BlockHopper.h2
-rw-r--r--src/Blocks/BlockLadder.h7
-rw-r--r--src/Blocks/BlockLeaves.h2
-rw-r--r--src/Blocks/BlockLever.h14
-rw-r--r--src/Blocks/BlockQuartz.h2
-rw-r--r--src/Blocks/BlockRail.h7
-rw-r--r--src/Blocks/BlockSideways.h2
-rw-r--r--src/Blocks/BlockSlab.h4
-rw-r--r--src/Blocks/BlockTorch.h2
-rw-r--r--src/Blocks/BlockTrapdoor.h4
-rw-r--r--src/Blocks/BlockTripwireHook.h8
-rw-r--r--src/Blocks/BlockWallSign.h12
-rw-r--r--src/Blocks/CMakeLists.txt5
18 files changed, 60 insertions, 33 deletions
diff --git a/src/Blocks/BlockAnvil.h b/src/Blocks/BlockAnvil.h
index abfa0f782..154394550 100644
--- a/src/Blocks/BlockAnvil.h
+++ b/src/Blocks/BlockAnvil.h
@@ -46,10 +46,10 @@ public:
switch (Direction)
{
- case 0: a_BlockMeta = 0x2 | Meta << 2; break;
- case 1: a_BlockMeta = 0x3 | Meta << 2; break;
- case 2: a_BlockMeta = 0x0 | Meta << 2; break;
- case 3: a_BlockMeta = 0x1 | Meta << 2; break;
+ case 0: a_BlockMeta = static_cast<NIBBLETYPE>(0x2 | Meta << 2); break;
+ case 1: a_BlockMeta = static_cast<NIBBLETYPE>(0x3 | Meta << 2); break;
+ case 2: a_BlockMeta = static_cast<NIBBLETYPE>(0x0 | Meta << 2); break;
+ case 3: a_BlockMeta = static_cast<NIBBLETYPE>(0x1 | Meta << 2); break;
default:
{
return false;
diff --git a/src/Blocks/BlockBed.h b/src/Blocks/BlockBed.h
index 46f361686..57ffebfca 100644
--- a/src/Blocks/BlockBed.h
+++ b/src/Blocks/BlockBed.h
@@ -53,7 +53,7 @@ public:
a_Rotation = (a_Rotation / 360) * 4;
- return ((char)a_Rotation + 2) % 4;
+ return (static_cast<NIBBLETYPE>(a_Rotation + 2)) % 4;
}
static Vector3i MetaDataToDirection(NIBBLETYPE a_MetaData)
diff --git a/src/Blocks/BlockButton.h b/src/Blocks/BlockButton.h
index d24c7d952..d65d9722d 100644
--- a/src/Blocks/BlockButton.h
+++ b/src/Blocks/BlockButton.h
@@ -67,7 +67,7 @@ public:
case BLOCK_FACE_XM: return 0x2;
case BLOCK_FACE_XP: return 0x1;
case BLOCK_FACE_YM: return 0x0;
- default:
+ case BLOCK_FACE_NONE:
{
ASSERT(!"Unhandled block face!");
return 0x0;
diff --git a/src/Blocks/BlockCocoaPod.h b/src/Blocks/BlockCocoaPod.h
index 1b659d48f..50552c788 100644
--- a/src/Blocks/BlockCocoaPod.h
+++ b/src/Blocks/BlockCocoaPod.h
@@ -81,7 +81,9 @@ public:
case BLOCK_FACE_XM: return 3;
case BLOCK_FACE_XP: return 1;
case BLOCK_FACE_ZP: return 2;
- default:
+ case BLOCK_FACE_NONE:
+ case BLOCK_FACE_YM:
+ case BLOCK_FACE_YP:
{
ASSERT(!"Unknown face");
return 0;
diff --git a/src/Blocks/BlockDoor.h b/src/Blocks/BlockDoor.h
index 445383e7c..9332e6728 100644
--- a/src/Blocks/BlockDoor.h
+++ b/src/Blocks/BlockDoor.h
@@ -245,10 +245,10 @@ public:
if (a_BlockX > 0)
{
NIBBLETYPE DownMeta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY - 1, a_BlockZ);
- return (NIBBLETYPE) ((DownMeta & 0x07) | 0x08 | (Meta << 4));
+ return static_cast<NIBBLETYPE>((DownMeta & 0x07) | 0x08 | (Meta << 4));
}
// This is the top part of the door at the bottommost layer of the world, there's no bottom:
- return (NIBBLETYPE) (0x08 | (Meta << 4));
+ return static_cast<NIBBLETYPE>(0x08 | (Meta << 4));
}
else
{
@@ -256,7 +256,7 @@ public:
if (a_BlockY < cChunkDef::Height - 1)
{
NIBBLETYPE UpMeta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY + 1, a_BlockZ);
- return (NIBBLETYPE) (Meta | (UpMeta << 4));
+ return static_cast<NIBBLETYPE>(Meta | (UpMeta << 4));
}
// This is the bottom part of the door at the topmost layer of the world, there's no top:
return Meta;
diff --git a/src/Blocks/BlockHopper.h b/src/Blocks/BlockHopper.h
index 4a5d32dd5..06e2b0e9f 100644
--- a/src/Blocks/BlockHopper.h
+++ b/src/Blocks/BlockHopper.h
@@ -35,7 +35,7 @@ public:
case BLOCK_FACE_NORTH: a_BlockMeta = E_META_HOPPER_FACING_ZP; break;
case BLOCK_FACE_SOUTH: a_BlockMeta = E_META_HOPPER_FACING_ZM; break;
case BLOCK_FACE_WEST: a_BlockMeta = E_META_HOPPER_FACING_XP; break;
- default: a_BlockMeta = E_META_HOPPER_UNATTACHED; break;
+ case BLOCK_FACE_NONE: a_BlockMeta = E_META_HOPPER_UNATTACHED; break;
}
return true;
}
diff --git a/src/Blocks/BlockLadder.h b/src/Blocks/BlockLadder.h
index ab3f55439..f49f1adc7 100644
--- a/src/Blocks/BlockLadder.h
+++ b/src/Blocks/BlockLadder.h
@@ -57,7 +57,12 @@ public:
case BLOCK_FACE_ZP: return 0x3;
case BLOCK_FACE_XM: return 0x4;
case BLOCK_FACE_XP: return 0x5;
- default: return 0x2;
+ case BLOCK_FACE_NONE:
+ case BLOCK_FACE_YM:
+ case BLOCK_FACE_YP:
+ {
+ return 0x2;
+ }
}
}
diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h
index 4d4610fd8..5c9283979 100644
--- a/src/Blocks/BlockLeaves.h
+++ b/src/Blocks/BlockLeaves.h
@@ -59,7 +59,7 @@ public:
cItem(
E_BLOCK_SAPLING,
1,
- (m_BlockType == E_BLOCK_LEAVES) ? (a_BlockMeta & 0x03) : (4 + (a_BlockMeta & 0x01))
+ (m_BlockType == E_BLOCK_LEAVES) ? (a_BlockMeta & 0x03) : static_cast<short>(4 + (a_BlockMeta & 0x01))
)
);
}
diff --git a/src/Blocks/BlockLever.h b/src/Blocks/BlockLever.h
index 2da138e5f..5792d280b 100644
--- a/src/Blocks/BlockLever.h
+++ b/src/Blocks/BlockLever.h
@@ -59,13 +59,13 @@ public:
// Determine lever direction:
switch (a_Dir)
{
- case BLOCK_FACE_YP: return 0x6;
- case BLOCK_FACE_XP: return 0x1;
- case BLOCK_FACE_XM: return 0x2;
- case BLOCK_FACE_ZP: return 0x3;
- case BLOCK_FACE_ZM: return 0x4;
- case BLOCK_FACE_YM: return 0x0;
- default: return 0x6;
+ case BLOCK_FACE_YP: return 0x6;
+ case BLOCK_FACE_XP: return 0x1;
+ case BLOCK_FACE_XM: return 0x2;
+ case BLOCK_FACE_ZP: return 0x3;
+ case BLOCK_FACE_ZM: return 0x4;
+ case BLOCK_FACE_YM: return 0x0;
+ case BLOCK_FACE_NONE: return 0x6;
}
}
diff --git a/src/Blocks/BlockQuartz.h b/src/Blocks/BlockQuartz.h
index edc4fb9c5..6f5c23902 100644
--- a/src/Blocks/BlockQuartz.h
+++ b/src/Blocks/BlockQuartz.h
@@ -58,7 +58,7 @@ public:
return 0x3; // East or west
}
- default:
+ case BLOCK_FACE_NONE:
{
ASSERT(!"Unhandled block face!");
return a_QuartzMeta; // No idea, give a special meta (all sides the same)
diff --git a/src/Blocks/BlockRail.h b/src/Blocks/BlockRail.h
index a2e27a351..eecd07006 100644
--- a/src/Blocks/BlockRail.h
+++ b/src/Blocks/BlockRail.h
@@ -487,7 +487,12 @@ public:
}
break;
}
- default: break;
+ case BLOCK_FACE_NONE:
+ case BLOCK_FACE_YM:
+ case BLOCK_FACE_YP:
+ {
+ break;
+ }
}
return true;
}
diff --git a/src/Blocks/BlockSideways.h b/src/Blocks/BlockSideways.h
index 4b1e38d6d..74b05e33c 100644
--- a/src/Blocks/BlockSideways.h
+++ b/src/Blocks/BlockSideways.h
@@ -58,7 +58,7 @@ public:
return a_Meta | 0x4; // East or west
}
- default:
+ case BLOCK_FACE_NONE:
{
ASSERT(!"Unhandled block face!");
return a_Meta | 0xC; // No idea, give a special meta
diff --git a/src/Blocks/BlockSlab.h b/src/Blocks/BlockSlab.h
index d762154df..9b3fad72e 100644
--- a/src/Blocks/BlockSlab.h
+++ b/src/Blocks/BlockSlab.h
@@ -41,7 +41,7 @@ public:
) override
{
a_BlockType = m_BlockType;
- NIBBLETYPE Meta = (NIBBLETYPE) a_Player->GetEquippedItem().m_ItemDamage;
+ NIBBLETYPE Meta = static_cast<NIBBLETYPE>(a_Player->GetEquippedItem().m_ItemDamage);
// Set the correct metadata based on player equipped item (i.e. a_BlockMeta not initialised yet)
switch (a_BlockFace)
@@ -104,7 +104,7 @@ public:
virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override
{
- if ((a_BlockFace == BLOCK_FACE_NONE) || (a_Player->GetEquippedItem().m_ItemType != (short)m_BlockType))
+ if ((a_BlockFace == BLOCK_FACE_NONE) || (a_Player->GetEquippedItem().m_ItemType != static_cast<short>(m_BlockType)))
{
return;
}
diff --git a/src/Blocks/BlockTorch.h b/src/Blocks/BlockTorch.h
index 3abc572f3..36d2fec67 100644
--- a/src/Blocks/BlockTorch.h
+++ b/src/Blocks/BlockTorch.h
@@ -59,7 +59,7 @@ public:
case BLOCK_FACE_WEST: return E_META_TORCH_WEST;
case BLOCK_FACE_NORTH: return E_META_TORCH_NORTH;
case BLOCK_FACE_SOUTH: return E_META_TORCH_SOUTH;
- default:
+ case BLOCK_FACE_NONE:
{
ASSERT(!"Unhandled torch direction!");
break;
diff --git a/src/Blocks/BlockTrapdoor.h b/src/Blocks/BlockTrapdoor.h
index dbb0b5a5b..2841e3e08 100644
--- a/src/Blocks/BlockTrapdoor.h
+++ b/src/Blocks/BlockTrapdoor.h
@@ -74,7 +74,9 @@ public:
case BLOCK_FACE_ZM: return 0x0;
case BLOCK_FACE_XP: return 0x3;
case BLOCK_FACE_XM: return 0x2;
- default:
+ case BLOCK_FACE_NONE:
+ case BLOCK_FACE_YM:
+ case BLOCK_FACE_YP:
{
ASSERT(!"Unhandled block face!");
return 0;
diff --git a/src/Blocks/BlockTripwireHook.h b/src/Blocks/BlockTripwireHook.h
index 88d389711..c7a96d393 100644
--- a/src/Blocks/BlockTripwireHook.h
+++ b/src/Blocks/BlockTripwireHook.h
@@ -37,7 +37,13 @@ public:
case BLOCK_FACE_XP: return 0x3;
case BLOCK_FACE_ZM: return 0x2;
case BLOCK_FACE_ZP: return 0x0;
- default: ASSERT(!"Unhandled tripwire hook direction!"); return 0x0;
+ case BLOCK_FACE_NONE:
+ case BLOCK_FACE_YM:
+ case BLOCK_FACE_YP:
+ {
+ ASSERT(!"Unhandled tripwire hook direction!");
+ return 0x0;
+ }
}
}
diff --git a/src/Blocks/BlockWallSign.h b/src/Blocks/BlockWallSign.h
index b6599d033..9b90b78bf 100644
--- a/src/Blocks/BlockWallSign.h
+++ b/src/Blocks/BlockWallSign.h
@@ -55,11 +55,13 @@ public:
{
switch (a_Direction)
{
- case 0x2: return 0x2;
- case 0x3: return 0x3;
- case 0x4: return 0x4;
- case 0x5: return 0x5;
- default:
+ case BLOCK_FACE_ZM: return 0x2;
+ case BLOCK_FACE_ZP: return 0x3;
+ case BLOCK_FACE_XM: return 0x4;
+ case BLOCK_FACE_XP: return 0x5;
+ case BLOCK_FACE_NONE:
+ case BLOCK_FACE_YP:
+ case BLOCK_FACE_YM:
{
break;
}
diff --git a/src/Blocks/CMakeLists.txt b/src/Blocks/CMakeLists.txt
index ed3e321d4..d8affd9cf 100644
--- a/src/Blocks/CMakeLists.txt
+++ b/src/Blocks/CMakeLists.txt
@@ -95,6 +95,11 @@ SET (HDRS
MetaRotator.h
WorldInterface.h)
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set_source_files_properties(BlockHandler.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+ set_source_files_properties(BlockPiston.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
+endif()
+
if(NOT MSVC)
add_library(Blocks ${SRCS} ${HDRS})
endif()