Fix switch warnings (#4013)
* Fix switch warnings
* Fix a variety of -Wswitch and -Wswitch-enum warnings
* Remove unneeded -Wno-error flags
* Reorganise some eMonsterType switches
* Alpha sort eMonsterType cases in WriteMobMetadata
and in cNBTChunkSerializer::AddMonsterEntity
* List all mob types in protocol 1.12 and NBTChunkSerializer
* cStructGenTrees::GetNumTrees: remove switch default
* cWSSAnvil::LoadOldMinecartFromNBT: Log unhandled minecart type
This commit is contained in:
committed by
Alexander Harkness
parent
e24186bb13
commit
307e7aaff5
@@ -716,22 +716,25 @@ cBlockEntity * cWSSAnvil::LoadBlockEntityFromNBT(const cParsedNBT & a_NBT, int a
|
||||
|
||||
// Blocktypes that have block entities but don't load their contents from disk:
|
||||
case E_BLOCK_ENDER_CHEST: return nullptr;
|
||||
}
|
||||
|
||||
// All the other blocktypes should have no entities assigned to them. Report an error:
|
||||
// Get the "id" tag:
|
||||
int TagID = a_NBT.FindChildByName(a_Tag, "id");
|
||||
AString TypeName("<unknown>");
|
||||
if (TagID >= 0)
|
||||
{
|
||||
TypeName.assign(a_NBT.GetData(TagID), static_cast<size_t>(a_NBT.GetDataLength(TagID)));
|
||||
default:
|
||||
{
|
||||
// All the other blocktypes should have no entities assigned to them. Report an error:
|
||||
// Get the "id" tag:
|
||||
int TagID = a_NBT.FindChildByName(a_Tag, "id");
|
||||
AString TypeName("<unknown>");
|
||||
if (TagID >= 0)
|
||||
{
|
||||
TypeName.assign(a_NBT.GetData(TagID), static_cast<size_t>(a_NBT.GetDataLength(TagID)));
|
||||
}
|
||||
LOGINFO("WorldLoader(%s): Block entity mismatch: block type %s (%d), type \"%s\", at {%d, %d, %d}; the entity will be lost.",
|
||||
m_World->GetName().c_str(),
|
||||
ItemTypeToString(a_BlockType).c_str(), a_BlockType, TypeName.c_str(),
|
||||
a_BlockX, a_BlockY, a_BlockZ
|
||||
);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
LOGINFO("WorldLoader(%s): Block entity mismatch: block type %s (%d), type \"%s\", at {%d, %d, %d}; the entity will be lost.",
|
||||
m_World->GetName().c_str(),
|
||||
ItemTypeToString(a_BlockType).c_str(), a_BlockType, TypeName.c_str(),
|
||||
a_BlockX, a_BlockY, a_BlockZ
|
||||
);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -1645,13 +1648,15 @@ void cWSSAnvil::LoadOldMinecartFromNBT(cEntityList & a_Entities, const cParsedNB
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (a_NBT.GetInt(TypeTag))
|
||||
int MinecartType = a_NBT.GetInt(TypeTag);
|
||||
switch (MinecartType)
|
||||
{
|
||||
case 0: LoadMinecartRFromNBT(a_Entities, a_NBT, a_TagIdx); break; // Rideable minecart
|
||||
case 1: LoadMinecartCFromNBT(a_Entities, a_NBT, a_TagIdx); break; // Minecart with chest
|
||||
case 2: LoadMinecartFFromNBT(a_Entities, a_NBT, a_TagIdx); break; // Minecart with furnace
|
||||
case 3: LoadMinecartTFromNBT(a_Entities, a_NBT, a_TagIdx); break; // Minecart with TNT
|
||||
case 4: LoadMinecartHFromNBT(a_Entities, a_NBT, a_TagIdx); break; // Minecart with Hopper
|
||||
default: LOGWARNING("cWSSAnvil::LoadOldMinecartFromNBT: Unhandled minecart type (%d)", MinecartType); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user