summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-06-02 12:51:43 +0200
committerMattes D <github@xoft.cz>2015-06-02 12:51:43 +0200
commit48c153bf53d5606e351bd180e2fd9345034f60aa (patch)
tree060d1b7203b9454eb4c6fbfe086724f383ec6899
parentMerge pull request #2172 from mc-server/LightingCallbacks (diff)
downloadcuberite-48c153bf53d5606e351bd180e2fd9345034f60aa.tar
cuberite-48c153bf53d5606e351bd180e2fd9345034f60aa.tar.gz
cuberite-48c153bf53d5606e351bd180e2fd9345034f60aa.tar.bz2
cuberite-48c153bf53d5606e351bd180e2fd9345034f60aa.tar.lz
cuberite-48c153bf53d5606e351bd180e2fd9345034f60aa.tar.xz
cuberite-48c153bf53d5606e351bd180e2fd9345034f60aa.tar.zst
cuberite-48c153bf53d5606e351bd180e2fd9345034f60aa.zip
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockButton.h6
-rw-r--r--src/Blocks/BlockCocoaPod.h4
-rw-r--r--src/Blocks/BlockLadder.h4
-rw-r--r--src/Blocks/BlockLever.h4
-rw-r--r--src/Blocks/BlockQuartz.h5
-rw-r--r--src/Blocks/BlockSideways.h4
-rw-r--r--src/Blocks/BlockTrapdoor.h7
-rw-r--r--src/Blocks/BlockTripwireHook.h8
-rw-r--r--src/Defines.h25
-rw-r--r--src/Entities/HangingEntity.h15
-rw-r--r--src/Generating/MineShafts.cpp7
-rw-r--r--src/MobCensus.cpp4
-rw-r--r--src/WorldStorage/FastNBT.cpp3
13 files changed, 92 insertions, 4 deletions
diff --git a/src/Blocks/BlockButton.h b/src/Blocks/BlockButton.h
index d65d9722d..154cd610e 100644
--- a/src/Blocks/BlockButton.h
+++ b/src/Blocks/BlockButton.h
@@ -73,8 +73,13 @@ public:
return 0x0;
}
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return 0;
+ #endif
}
+
inline static eBlockFace BlockMetaDataToBlockFace(NIBBLETYPE a_Meta)
{
switch (a_Meta & 0x7)
@@ -93,6 +98,7 @@ public:
}
}
+
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{
NIBBLETYPE Meta;
diff --git a/src/Blocks/BlockCocoaPod.h b/src/Blocks/BlockCocoaPod.h
index 50552c788..4d16d2552 100644
--- a/src/Blocks/BlockCocoaPod.h
+++ b/src/Blocks/BlockCocoaPod.h
@@ -89,6 +89,10 @@ public:
return 0;
}
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return 0;
+ #endif
}
} ;
diff --git a/src/Blocks/BlockLadder.h b/src/Blocks/BlockLadder.h
index f49f1adc7..d727f8f8e 100644
--- a/src/Blocks/BlockLadder.h
+++ b/src/Blocks/BlockLadder.h
@@ -64,6 +64,10 @@ public:
return 0x2;
}
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return 0;
+ #endif
}
diff --git a/src/Blocks/BlockLever.h b/src/Blocks/BlockLever.h
index 5792d280b..8d676b56f 100644
--- a/src/Blocks/BlockLever.h
+++ b/src/Blocks/BlockLever.h
@@ -67,6 +67,10 @@ public:
case BLOCK_FACE_YM: return 0x0;
case BLOCK_FACE_NONE: return 0x6;
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return 0;
+ #endif
}
diff --git a/src/Blocks/BlockQuartz.h b/src/Blocks/BlockQuartz.h
index 6f5c23902..b936a7e4a 100644
--- a/src/Blocks/BlockQuartz.h
+++ b/src/Blocks/BlockQuartz.h
@@ -36,6 +36,7 @@ public:
return true;
}
+
inline static NIBBLETYPE BlockFaceToMetaData(eBlockFace a_BlockFace, NIBBLETYPE a_QuartzMeta)
{
switch (a_BlockFace)
@@ -64,5 +65,9 @@ public:
return a_QuartzMeta; // No idea, give a special meta (all sides the same)
}
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return 0;
+ #endif
}
} ;
diff --git a/src/Blocks/BlockSideways.h b/src/Blocks/BlockSideways.h
index 74b05e33c..e52fbaa2f 100644
--- a/src/Blocks/BlockSideways.h
+++ b/src/Blocks/BlockSideways.h
@@ -64,6 +64,10 @@ public:
return a_Meta | 0xC; // No idea, give a special meta
}
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return 0;
+ #endif
}
} ;
diff --git a/src/Blocks/BlockTrapdoor.h b/src/Blocks/BlockTrapdoor.h
index 2841e3e08..a1d2dff6f 100644
--- a/src/Blocks/BlockTrapdoor.h
+++ b/src/Blocks/BlockTrapdoor.h
@@ -66,6 +66,7 @@ public:
return true;
}
+
inline static NIBBLETYPE BlockFaceToMetaData(eBlockFace a_BlockFace)
{
switch (a_BlockFace)
@@ -82,8 +83,13 @@ public:
return 0;
}
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return 0;
+ #endif
}
+
inline static eBlockFace BlockMetaDataToBlockFace(NIBBLETYPE a_Meta)
{
switch (a_Meta & 0x3)
@@ -100,6 +106,7 @@ public:
}
}
+
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{
NIBBLETYPE Meta;
diff --git a/src/Blocks/BlockTripwireHook.h b/src/Blocks/BlockTripwireHook.h
index c7a96d393..39892af5a 100644
--- a/src/Blocks/BlockTripwireHook.h
+++ b/src/Blocks/BlockTripwireHook.h
@@ -16,6 +16,7 @@ public:
{
}
+
virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
@@ -29,6 +30,7 @@ public:
return true;
}
+
inline static NIBBLETYPE DirectionToMetadata(eBlockFace a_Direction)
{
switch (a_Direction)
@@ -45,8 +47,13 @@ public:
return 0x0;
}
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return 0;
+ #endif
}
+
inline static eBlockFace MetadataToDirection(NIBBLETYPE a_Meta)
{
switch (a_Meta & 0x03)
@@ -59,6 +66,7 @@ public:
}
}
+
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
// Reset meta to zero
diff --git a/src/Defines.h b/src/Defines.h
index bbc69f79c..4005c84dd 100644
--- a/src/Defines.h
+++ b/src/Defines.h
@@ -245,6 +245,10 @@ inline eBlockFace MirrorBlockFaceY(eBlockFace a_BlockFace)
return a_BlockFace;
};
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return a_BlockFace;
+ #endif
}
@@ -267,6 +271,10 @@ inline eBlockFace RotateBlockFaceCCW(eBlockFace a_BlockFace)
return a_BlockFace;
}
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return a_BlockFace;
+ #endif
}
@@ -288,8 +296,16 @@ inline eBlockFace RotateBlockFaceCW(eBlockFace a_BlockFace)
return a_BlockFace;
};
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return a_BlockFace;
+ #endif
}
+
+
+
+
inline eBlockFace ReverseBlockFace(eBlockFace a_BlockFace)
{
switch (a_BlockFace)
@@ -302,9 +318,16 @@ inline eBlockFace ReverseBlockFace(eBlockFace a_BlockFace)
case BLOCK_FACE_ZM: return BLOCK_FACE_ZP;
case BLOCK_FACE_NONE: return a_BlockFace;
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown BLOCK_FACE");
+ return a_BlockFace;
+ #endif
}
+
+
+
/** Returns the textual representation of the BlockFace constant. */
inline AString BlockFaceToString(eBlockFace a_BlockFace)
{
@@ -320,7 +343,7 @@ inline AString BlockFaceToString(eBlockFace a_BlockFace)
}
// clang optimisises this line away then warns that it has done so.
#if !defined(__clang__)
- return Printf("Unknown BLOCK_FACE: %d", a_BlockFace);
+ return Printf("Unknown BLOCK_FACE: %d", a_BlockFace);
#endif
}
diff --git a/src/Entities/HangingEntity.h b/src/Entities/HangingEntity.h
index 4d70cd1a0..5d0aa17b3 100644
--- a/src/Entities/HangingEntity.h
+++ b/src/Entities/HangingEntity.h
@@ -46,6 +46,9 @@ public:
protected:
+ Byte m_Facing;
+
+
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override
{
@@ -53,6 +56,7 @@ protected:
UNUSED(a_Chunk);
}
+
/** Converts protocol hanging item facing to eBlockFace values */
inline static eBlockFace ProtocolFaceToBlockFace(Byte a_ProtocolFace)
{
@@ -77,6 +81,7 @@ protected:
return Dir;
}
+
/** Converts eBlockFace values to protocol hanging item faces */
inline static Byte BlockFaceToProtocolFace(eBlockFace a_BlockFace)
{
@@ -99,13 +104,17 @@ protected:
Dir = cHangingEntity::BlockFaceToProtocolFace(BLOCK_FACE_XP);
}
+ #if !defined(__clang__)
+ default:
+ {
+ ASSERT(!"Unknown BLOCK_FACE");
+ return 0;
+ }
+ #endif
}
return Dir;
}
-
- Byte m_Facing;
-
}; // tolua_export
diff --git a/src/Generating/MineShafts.cpp b/src/Generating/MineShafts.cpp
index 88dade240..4ba896ef6 100644
--- a/src/Generating/MineShafts.cpp
+++ b/src/Generating/MineShafts.cpp
@@ -787,6 +787,13 @@ void cMineShaftCorridor::PlaceChest(cChunkDesc & a_ChunkDesc)
Meta = E_META_CHEST_FACING_XP;
break;
}
+ #if !defined(__clang__)
+ default:
+ {
+ ASSERT(!"Unknown direction");
+ return;
+ }
+ #endif
} // switch (Dir)
if (
diff --git a/src/MobCensus.cpp b/src/MobCensus.cpp
index ca960a2bc..79b5176d2 100644
--- a/src/MobCensus.cpp
+++ b/src/MobCensus.cpp
@@ -48,6 +48,10 @@ int cMobCensus::GetCapMultiplier(cMonster::eFamily a_MobFamily)
return -1;
}
}
+ #if !defined(__clang__)
+ ASSERT(!"Unknown mob family");
+ return -1;
+ #endif
}
diff --git a/src/WorldStorage/FastNBT.cpp b/src/WorldStorage/FastNBT.cpp
index f77197914..860eb3a4a 100644
--- a/src/WorldStorage/FastNBT.cpp
+++ b/src/WorldStorage/FastNBT.cpp
@@ -257,6 +257,9 @@ bool cParsedNBT::ReadTag(void)
return true;
}
+ #if !defined(__clang__)
+ default:
+ #endif
case TAG_Min:
{
ASSERT(!"Unhandled NBT tag type");