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; return 0x0;
} }
} }
#if !defined(__clang__)
ASSERT(!"Unknown BLOCK_FACE");
return 0;
#endif
} }
inline static eBlockFace BlockMetaDataToBlockFace(NIBBLETYPE a_Meta) inline static eBlockFace BlockMetaDataToBlockFace(NIBBLETYPE a_Meta)
{ {
switch (a_Meta & 0x7) 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 virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{ {
NIBBLETYPE Meta; NIBBLETYPE Meta;

View File

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

View File

@ -64,6 +64,10 @@ public:
return 0x2; 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_YM: return 0x0;
case BLOCK_FACE_NONE: return 0x6; 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; return true;
} }
inline static NIBBLETYPE BlockFaceToMetaData(eBlockFace a_BlockFace, NIBBLETYPE a_QuartzMeta) inline static NIBBLETYPE BlockFaceToMetaData(eBlockFace a_BlockFace, NIBBLETYPE a_QuartzMeta)
{ {
switch (a_BlockFace) switch (a_BlockFace)
@ -64,5 +65,9 @@ public:
return a_QuartzMeta; // No idea, give a special meta (all sides the same) 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 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; return true;
} }
inline static NIBBLETYPE BlockFaceToMetaData(eBlockFace a_BlockFace) inline static NIBBLETYPE BlockFaceToMetaData(eBlockFace a_BlockFace)
{ {
switch (a_BlockFace) switch (a_BlockFace)
@ -82,8 +83,13 @@ public:
return 0; return 0;
} }
} }
#if !defined(__clang__)
ASSERT(!"Unknown BLOCK_FACE");
return 0;
#endif
} }
inline static eBlockFace BlockMetaDataToBlockFace(NIBBLETYPE a_Meta) inline static eBlockFace BlockMetaDataToBlockFace(NIBBLETYPE a_Meta)
{ {
switch (a_Meta & 0x3) 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 virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{ {
NIBBLETYPE Meta; NIBBLETYPE Meta;

View File

@ -16,6 +16,7 @@ public:
{ {
} }
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
@ -29,6 +30,7 @@ public:
return true; return true;
} }
inline static NIBBLETYPE DirectionToMetadata(eBlockFace a_Direction) inline static NIBBLETYPE DirectionToMetadata(eBlockFace a_Direction)
{ {
switch (a_Direction) switch (a_Direction)
@ -45,8 +47,13 @@ public:
return 0x0; return 0x0;
} }
} }
#if !defined(__clang__)
ASSERT(!"Unknown BLOCK_FACE");
return 0;
#endif
} }
inline static eBlockFace MetadataToDirection(NIBBLETYPE a_Meta) inline static eBlockFace MetadataToDirection(NIBBLETYPE a_Meta)
{ {
switch (a_Meta & 0x03) switch (a_Meta & 0x03)
@ -59,6 +66,7 @@ public:
} }
} }
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{ {
// Reset meta to zero // Reset meta to zero

View File

@ -245,6 +245,10 @@ inline eBlockFace MirrorBlockFaceY(eBlockFace a_BlockFace)
return 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; 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; return a_BlockFace;
}; };
} }
#if !defined(__clang__)
ASSERT(!"Unknown BLOCK_FACE");
return a_BlockFace;
#endif
} }
inline eBlockFace ReverseBlockFace(eBlockFace a_BlockFace) inline eBlockFace ReverseBlockFace(eBlockFace a_BlockFace)
{ {
switch (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_ZM: return BLOCK_FACE_ZP;
case BLOCK_FACE_NONE: return a_BlockFace; 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. */ /** Returns the textual representation of the BlockFace constant. */
inline AString BlockFaceToString(eBlockFace a_BlockFace) inline AString BlockFaceToString(eBlockFace a_BlockFace)
{ {

View File

@ -46,6 +46,9 @@ public:
protected: protected:
Byte m_Facing;
virtual void SpawnOn(cClientHandle & a_ClientHandle) override; virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override
{ {
@ -53,6 +56,7 @@ protected:
UNUSED(a_Chunk); UNUSED(a_Chunk);
} }
/** Converts protocol hanging item facing to eBlockFace values */ /** Converts protocol hanging item facing to eBlockFace values */
inline static eBlockFace ProtocolFaceToBlockFace(Byte a_ProtocolFace) inline static eBlockFace ProtocolFaceToBlockFace(Byte a_ProtocolFace)
{ {
@ -77,6 +81,7 @@ protected:
return Dir; return Dir;
} }
/** Converts eBlockFace values to protocol hanging item faces */ /** Converts eBlockFace values to protocol hanging item faces */
inline static Byte BlockFaceToProtocolFace(eBlockFace a_BlockFace) inline static Byte BlockFaceToProtocolFace(eBlockFace a_BlockFace)
{ {
@ -99,13 +104,17 @@ protected:
Dir = cHangingEntity::BlockFaceToProtocolFace(BLOCK_FACE_XP); Dir = cHangingEntity::BlockFaceToProtocolFace(BLOCK_FACE_XP);
} }
#if !defined(__clang__)
default:
{
ASSERT(!"Unknown BLOCK_FACE");
return 0;
}
#endif
} }
return Dir; return Dir;
} }
Byte m_Facing;
}; // tolua_export }; // tolua_export

View File

@ -787,6 +787,13 @@ void cMineShaftCorridor::PlaceChest(cChunkDesc & a_ChunkDesc)
Meta = E_META_CHEST_FACING_XP; Meta = E_META_CHEST_FACING_XP;
break; break;
} }
#if !defined(__clang__)
default:
{
ASSERT(!"Unknown direction");
return;
}
#endif
} // switch (Dir) } // switch (Dir)
if ( if (

View File

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

View File

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