From 87a7bfa9aa1edd0d4ba467b341147fcaab3be7cf Mon Sep 17 00:00:00 2001 From: "admin@omencraft.com" Date: Sun, 30 Oct 2011 07:10:22 +0000 Subject: Added Long Tag. It'll now go through the entire NBT data without erroring out. I'm not sure that it's actually saving all tag 7 data though. git-svn-id: http://mc-server.googlecode.com/svn/trunk@24 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- converter/cNBTData.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'converter/cNBTData.cpp') diff --git a/converter/cNBTData.cpp b/converter/cNBTData.cpp index a492f847c..845e8382b 100644 --- a/converter/cNBTData.cpp +++ b/converter/cNBTData.cpp @@ -30,6 +30,7 @@ cNBTData::cNBTData( char* a_Buffer, unsigned int a_BufferSize ) m_ParseFunctions[TAG_Byte] = &cNBTData::ParseByte; m_ParseFunctions[TAG_Short] = &cNBTData::ParseShort; m_ParseFunctions[TAG_Int] = &cNBTData::ParseInt; + m_ParseFunctions[TAG_Long] = &cNBTData::ParseLong; m_ParseFunctions[TAG_String] = &cNBTData::ParseString; m_ParseFunctions[TAG_List] = &cNBTData::ParseList; m_ParseFunctions[TAG_Compound] = &cNBTData::ParseCompound; @@ -519,6 +520,17 @@ void cNBTData::ParseInt( bool a_bNamed ) printf("INT: %s %i\n", Name.c_str(), Value );//re } +void cNBTData::ParseLong( bool a_bNamed ) +{ + std::string Name; + if( a_bNamed ) Name = ReadName(); + long Value = ReadLong(); + + PutInteger( Name, Value ); + + printf("LONG: %s %li\n", Name.c_str(), Value );//re +} + void cNBTData::ParseString( bool a_bNamed ) { std::string Name; @@ -593,6 +605,15 @@ int cNBTData::ReadInt() return ntohl( Value ); } +long cNBTData::ReadLong() +{ + long Value = 0; + memcpy( &Value, m_Buffer+m_Index, sizeof(long) ); + m_Index+=sizeof(long); + + return ntohl( Value ); +} + void cNBTCompound::PutList( std::string Name, ENUM_TAG Type ) { m_Lists[Name] = new cNBTList( m_CurrentList, Type ); -- cgit v1.2.3