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 | |
parent | 241e2461446a830194f202b840abcd3598f804a5 (diff) | |
download | mana-e4e3f73db10d345453f2c6d06ae1dc499a4c7404.tar.gz mana-e4e3f73db10d345453f2c6d06ae1dc499a4c7404.tar.bz2 mana-e4e3f73db10d345453f2c6d06ae1dc499a4c7404.tar.xz mana-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')
-rw-r--r-- | src/resources/image.h | 1 | ||||
-rw-r--r-- | src/resources/itemmanager.cpp | 20 | ||||
-rw-r--r-- | src/resources/resource.cpp | 5 | ||||
-rw-r--r-- | src/resources/resource.h | 5 |
4 files changed, 21 insertions, 10 deletions
diff --git a/src/resources/image.h b/src/resources/image.h index 807f0fb0..ebc2c971 100644 --- a/src/resources/image.h +++ b/src/resources/image.h @@ -155,7 +155,6 @@ class SubImage : public Image /** * Constructor. */ - //SubImage(SDL_Surface *timage, int x, int y, int width, int height); #ifndef USE_OPENGL SubImage(Image *parent, SDL_Surface *image, int x, int y, int width, int height); 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)!"); } diff --git a/src/resources/resource.cpp b/src/resources/resource.cpp index ad76f266..b3aa80f6 100644 --- a/src/resources/resource.cpp +++ b/src/resources/resource.cpp @@ -28,6 +28,11 @@ Resource::Resource(): { } +Resource::~Resource() +{ + // TODO: Notify resource manager about this resource being deleted +} + bool Resource::isLoaded() const { return loaded; diff --git a/src/resources/resource.h b/src/resources/resource.h index bd6bfcc5..266b4198 100644 --- a/src/resources/resource.h +++ b/src/resources/resource.h @@ -36,6 +36,11 @@ class Resource Resource(); /** + * Destructor. + */ + virtual ~Resource(); + + /** * Frees this objects internal resources. */ virtual void unload() = 0; |