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
This commit is contained in:
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user