summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/WSSAnvil.cpp
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2017-09-14 10:48:57 +0200
committerAlexander Harkness <me@bearbin.net>2017-09-14 10:48:57 +0200
commit307e7aaff5c454b703db4d536c40d5715d96032b (patch)
treee217d6a073e6b87aaeb6618a933676d3251b9355 /src/WorldStorage/WSSAnvil.cpp
parentUpdated compile.sh script (#4009) (diff)
downloadcuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar
cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar.gz
cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar.bz2
cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar.lz
cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar.xz
cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar.zst
cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.zip
Diffstat (limited to '')
-rwxr-xr-xsrc/WorldStorage/WSSAnvil.cpp35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index 158f7a819..b47d3eddd 100755
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -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;
}
}