summaryrefslogtreecommitdiff
path: root/src/resources/itemdb.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/itemdb.cpp')
-rw-r--r--src/resources/itemdb.cpp22
1 files changed, 3 insertions, 19 deletions
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 9d64534c..e8ad393b 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -59,26 +59,12 @@ void ItemDB::load()
mUnknown->setSprite("error.xml", 0);
mUnknown->setSprite("error.xml", 1);
- ResourceManager *resman = ResourceManager::getInstance();
- int size;
- char *data = (char*) resman->loadFile("items.xml", size);
+ XML::Document doc("items.xml");
+ xmlNodePtr rootNode = doc.rootNode();
- if (!data) {
- logger->error("ItemDB: Could not find items.xml!");
- }
-
- xmlDocPtr doc = xmlParseMemory(data, size);
- free(data);
-
- if (!doc)
- {
- logger->error("ItemDB: Error while parsing item database (items.xml)!");
- }
-
- xmlNodePtr rootNode = xmlDocGetRootElement(doc);
if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "items"))
{
- logger->error("ItemDB: items.xml is not a valid database file!");
+ logger->error("ItemDB: Error while loading items.xml!");
}
for_each_xml_child_node(node, rootNode)
@@ -150,8 +136,6 @@ void ItemDB::load()
#undef CHECK_PARAM
}
- xmlFreeDoc(doc);
-
mLoaded = true;
}