diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-05-21 22:39:53 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-05-21 22:39:53 +0000 |
commit | e4e3f73db10d345453f2c6d06ae1dc499a4c7404 (patch) | |
tree | 7117443cf1267f9354206c21d70ac4ae0ddefcec /src/resources/itemmanager.cpp | |
parent | 241e2461446a830194f202b840abcd3598f804a5 (diff) | |
download | mana-client-e4e3f73db10d345453f2c6d06ae1dc499a4c7404.tar.gz mana-client-e4e3f73db10d345453f2c6d06ae1dc499a4c7404.tar.bz2 mana-client-e4e3f73db10d345453f2c6d06ae1dc499a4c7404.tar.xz mana-client-e4e3f73db10d345453f2c6d06ae1dc499a4c7404.zip |
Numerous things:
* Fixed two non-virtual destructor warnings showing up with GCC 4.
* Fixed OpenGL inventory text drawing that broke in last commit
* Removed glClear cause screen is redrawn completely anyway
* Fixed updating of buttons in inventory window
* Made items.xml be loaded through resource manager.
Diffstat (limited to 'src/resources/itemmanager.cpp')
-rw-r--r-- | src/resources/itemmanager.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/resources/itemmanager.cpp b/src/resources/itemmanager.cpp index 05b0ff44..8ac05e08 100644 --- a/src/resources/itemmanager.cpp +++ b/src/resources/itemmanager.cpp @@ -26,6 +26,7 @@ #include <iostream> #include "itemmanager.h" +#include "resourcemanager.h" #include "../main.h" #include "../log.h" @@ -38,16 +39,16 @@ ItemManager::ItemManager() { - // Check that file exists before trying to parse it - std::fstream dbFile; - dbFile.open(TMW_DATADIR "data/items.xml", std::ios::in); - if (!dbFile.is_open()) { - logger->error("Cannot find item database (items.xml)!"); - return; + ResourceManager *resman = ResourceManager::getInstance(); + int size; + char *data = (char*)resman->loadFile("items.xml", size); + + if (!data) { + logger->error("Could not find items.xml!"); } - dbFile.close(); - xmlDocPtr doc = xmlParseFile(TMW_DATADIR "data/items.xml"); + xmlDocPtr doc = xmlParseMemory(data, size); + free(data); if (doc) { xmlNodePtr node = xmlDocGetRootElement(doc); @@ -104,7 +105,8 @@ ItemManager::ItemManager() } xmlFreeDoc(doc); - } else { + } + else { logger->error("Error while parsing item database (items.xml)!"); } |