1
0

Fixed warnings in MSVC.

It complained about undefined return values or using uninitialized variables.
This commit is contained in:
Mattes D 2015-06-02 12:51:43 +02:00
parent a54fa15bc6
commit 48c153bf53
13 changed files with 92 additions and 4 deletions

View File

@ -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;

View File

@ -89,6 +89,10 @@ public:
return 0;
}
}
#if !defined(__clang__)
ASSERT(!"Unknown BLOCK_FACE");
return 0;
#endif
}
} ;

View File

@ -64,6 +64,10 @@ public:
return 0x2;
}
}
#if !defined(__clang__)
ASSERT(!"Unknown BLOCK_FACE");
return 0;
#endif
}

View File

@ -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
}

View File

@ -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
}
} ;

View File

@ -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
}
} ;

View File

@ -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;

View File

@ -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

View File

@ -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)
{

View File

@ -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

View File

@ -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 (

View File

@ -48,6 +48,10 @@ int cMobCensus::GetCapMultiplier(cMonster::eFamily a_MobFamily)
return -1;
}
}
#if !defined(__clang__)
ASSERT(!"Unknown mob family");
return -1;
#endif
}

View File

@ -257,6 +257,9 @@ bool cParsedNBT::ReadTag(void)
return true;
}
#if !defined(__clang__)
default:
#endif
case TAG_Min:
{
ASSERT(!"Unhandled NBT tag type");