Mercurial > fife-parpg
diff engine/core/util/resource/pool.cpp @ 644:b84dbc4665b0
loaders extension can now handle multiple loaders for different filetypes. A difference between map and object files is now being made!
Fixed a small redundancy in the guimanager.
Added clearResourceLoaders() to the Pool class. This can be used if different resourceloaders have to be added at a later point in time (running editor for example, a plugin might want to have it's own loader added)
author | nihathrael@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 11 Oct 2010 22:20:00 +0000 |
parents | a46368b3d8a0 |
children |
line wrap: on
line diff
--- a/engine/core/util/resource/pool.cpp Sat Oct 09 17:00:33 2010 +0000 +++ b/engine/core/util/resource/pool.cpp Mon Oct 11 22:20:00 2010 +0000 @@ -34,8 +34,8 @@ namespace FIFE { static Logger _log(LM_POOL); - - Pool::Pool(const std::string& name): + + Pool::Pool(const std::string& name): m_entries(), m_location_to_entry(), m_loaders(), @@ -54,7 +54,7 @@ delete (*loader); } } - + void Pool::reset() { std::vector<PoolEntry*>::iterator entry; for (entry = m_entries.begin(); entry != m_entries.end(); entry++) { @@ -88,12 +88,16 @@ m_loaders.push_back(loader); } + void Pool::clearResourceLoaders() { + m_loaders.clear(); + } + int Pool::addResourceFromLocation(ResourceLocation* loc) { ResourceLocationToEntry::const_iterator it = m_location_to_entry.find(loc); if (it != m_location_to_entry.end()) { return it->second; } - + PoolEntry* entry = new PoolEntry(); entry->location = loc->clone(); m_entries.push_back(entry); @@ -128,7 +132,7 @@ msg << "#" << index << "<" << entry->location->getFilename() << "> in pool " << m_name; FL_ERR(_log, msg); - + throw NotFound(msg.str); } @@ -224,7 +228,7 @@ void Pool::sanityCheck() { // It is easy to mess up the important consistent // less-than operator for the location classes. - // This will check if according to the '==' operator + // This will check if according to the '==' operator // entries are duplicate (=memory leaks). // Slow and inaccurate. But should barf at real messups. for(unsigned i = 0; i != m_entries.size(); ++i) {