diff options
author | admin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-10-30 08:10:22 +0100 |
---|---|---|
committer | admin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-10-30 08:10:22 +0100 |
commit | 87a7bfa9aa1edd0d4ba467b341147fcaab3be7cf (patch) | |
tree | 5f4aacc1eab10d69e75f7c145990f8676fc8e1f0 /converter/cNBTData.cpp | |
parent | I think I got Tag 7 working, now I need to add tag 4 for the deNotch map converter. (diff) | |
download | cuberite-87a7bfa9aa1edd0d4ba467b341147fcaab3be7cf.tar cuberite-87a7bfa9aa1edd0d4ba467b341147fcaab3be7cf.tar.gz cuberite-87a7bfa9aa1edd0d4ba467b341147fcaab3be7cf.tar.bz2 cuberite-87a7bfa9aa1edd0d4ba467b341147fcaab3be7cf.tar.lz cuberite-87a7bfa9aa1edd0d4ba467b341147fcaab3be7cf.tar.xz cuberite-87a7bfa9aa1edd0d4ba467b341147fcaab3be7cf.tar.zst cuberite-87a7bfa9aa1edd0d4ba467b341147fcaab3be7cf.zip |
Diffstat (limited to '')
-rw-r--r-- | converter/cNBTData.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
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 ); |