summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/EnchantmentSerializer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/WorldStorage/EnchantmentSerializer.cpp')
-rw-r--r--src/WorldStorage/EnchantmentSerializer.cpp30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/WorldStorage/EnchantmentSerializer.cpp b/src/WorldStorage/EnchantmentSerializer.cpp
index 08db91115..d1f21f9be 100644
--- a/src/WorldStorage/EnchantmentSerializer.cpp
+++ b/src/WorldStorage/EnchantmentSerializer.cpp
@@ -5,17 +5,24 @@
#include "FastNBT.h"
#include "../Enchantments.h"
-void EnchantmentSerializer::WriteToNBTCompound(const cEnchantments & a_Enchantments, cFastNBTWriter & a_Writer, const AString & a_ListTagName)
+void EnchantmentSerializer::WriteToNBTCompound(
+ const cEnchantments & a_Enchantments,
+ cFastNBTWriter & a_Writer,
+ const AString & a_ListTagName
+)
{
// Write the enchantments into the specified NBT writer
// begin with the LIST tag of the specified name ("ench" or "StoredEnchantments")
a_Writer.BeginList(a_ListTagName, TAG_Compound);
- for (cEnchantments::cMap::const_iterator itr = a_Enchantments.m_Enchantments.begin(), end = a_Enchantments.m_Enchantments.end(); itr != end; ++itr)
+ for (cEnchantments::cMap::const_iterator itr = a_Enchantments.m_Enchantments.begin(),
+ end = a_Enchantments.m_Enchantments.end();
+ itr != end;
+ ++itr)
{
a_Writer.BeginCompound("");
- a_Writer.AddShort("id", static_cast<Int16>(itr->first));
- a_Writer.AddShort("lvl", static_cast<Int16>(itr->second));
+ a_Writer.AddShort("id", static_cast<Int16>(itr->first));
+ a_Writer.AddShort("lvl", static_cast<Int16>(itr->second));
a_Writer.EndCompound();
} // for itr - m_Enchantments[]
a_Writer.EndList();
@@ -32,8 +39,11 @@ void EnchantmentSerializer::ParseFromNBT(cEnchantments & a_Enchantments, const c
// Verify that the tag is a list:
if (a_NBT.GetType(a_EnchListTagIdx) != TAG_List)
{
- LOGWARNING("%s: Invalid EnchListTag type: exp %d, got %d. Enchantments not parsed",
- __FUNCTION__, TAG_List, a_NBT.GetType(a_EnchListTagIdx)
+ LOGWARNING(
+ "%s: Invalid EnchListTag type: exp %d, got %d. Enchantments not parsed",
+ __FUNCTION__,
+ TAG_List,
+ a_NBT.GetType(a_EnchListTagIdx)
);
ASSERT(!"Bad EnchListTag type");
return;
@@ -42,8 +52,11 @@ void EnchantmentSerializer::ParseFromNBT(cEnchantments & a_Enchantments, const c
// Verify that the list is of Compounds:
if (a_NBT.GetChildrenType(a_EnchListTagIdx) != TAG_Compound)
{
- LOGWARNING("%s: Invalid NBT list children type: exp %d, got %d. Enchantments not parsed",
- __FUNCTION__, TAG_Compound, a_NBT.GetChildrenType(a_EnchListTagIdx)
+ LOGWARNING(
+ "%s: Invalid NBT list children type: exp %d, got %d. Enchantments not parsed",
+ __FUNCTION__,
+ TAG_Compound,
+ a_NBT.GetChildrenType(a_EnchListTagIdx)
);
ASSERT(!"Bad EnchListTag children type");
return;
@@ -85,4 +98,3 @@ void EnchantmentSerializer::ParseFromNBT(cEnchantments & a_Enchantments, const c
a_Enchantments.m_Enchantments[id] = static_cast<unsigned int>(lvl);
} // for tag - children of the ench list tag
}
-