summaryrefslogtreecommitdiffstats
path: root/source/NBT.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-04-23 23:20:32 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-04-23 23:20:32 +0200
commit9cb88728511c314695731d92cb4ab16c8e3b051e (patch)
tree6503c19dec45a7dc39377de39a1ff625ea321fbf /source/NBT.cpp
parentLapis gets generated (thanks, Fordship) (diff)
downloadcuberite-9cb88728511c314695731d92cb4ab16c8e3b051e.tar
cuberite-9cb88728511c314695731d92cb4ab16c8e3b051e.tar.gz
cuberite-9cb88728511c314695731d92cb4ab16c8e3b051e.tar.bz2
cuberite-9cb88728511c314695731d92cb4ab16c8e3b051e.tar.lz
cuberite-9cb88728511c314695731d92cb4ab16c8e3b051e.tar.xz
cuberite-9cb88728511c314695731d92cb4ab16c8e3b051e.tar.zst
cuberite-9cb88728511c314695731d92cb4ab16c8e3b051e.zip
Diffstat (limited to '')
-rw-r--r--source/NBT.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/source/NBT.cpp b/source/NBT.cpp
index af420cd27..ba2f3d0f6 100644
--- a/source/NBT.cpp
+++ b/source/NBT.cpp
@@ -74,7 +74,7 @@ cNBTTag * cNBTTag::CreateTag(cNBTTag * a_Parent, eTagType a_Type, const AString
case TAG_Double: return new cNBTDouble (a_Parent, a_Name);
case TAG_ByteArray: return new cNBTByteArray(a_Parent, a_Name);
case TAG_String: return new cNBTString (a_Parent, a_Name);
- case TAG_List: return new cNBTList (a_Parent, a_Name);
+ case TAG_List: return new cNBTList (a_Parent, a_Name, TAG_End);
case TAG_Compound: return new cNBTCompound (a_Parent, a_Name);
default:
{
@@ -128,8 +128,8 @@ void cNBTList::Clear(void)
int cNBTList::Add(cNBTTag * iTag)
{
// Catch usage errors while debugging:
- ASSERT(m_ChildrenType != TAG_End);
- ASSERT(iTag->GetType() == m_ChildrenType);
+ ASSERT(m_ChildrenType != TAG_End); // Didn't call SetChildrenType()
+ ASSERT(iTag->GetType() == m_ChildrenType); // Child of different type
// Catch errors while running:
if (m_ChildrenType == TAG_End)
@@ -535,12 +535,11 @@ int cNBTParser::ReadTag(const char ** a_Data, int * a_Length, cNBTTag::eTagType
{
char ItemType;
RETURN_INT_IF_FAILED(ReadByte (a_Data, a_Length, ItemType));
- cNBTList * List = new cNBTList(a_Parent, a_Name);
+ cNBTList * List = new cNBTList(a_Parent, a_Name, (cNBTTag::eTagType)ItemType);
if (List == NULL)
{
return ERROR_NOT_ENOUGH_MEMORY;
}
- RETURN_INT_IF_FAILED(List->SetChildrenType((cNBTTag::eTagType)ItemType));
RETURN_INT_IF_FAILED(ReadList(a_Data, a_Length, List));
*a_Tag = List;
return ERROR_SUCCESS;