Mercurial > fife-parpg
diff engine/core/util/resource/pool.cpp @ 156:376b8afc9a18
Fixed a horrendous misconeception in the pool.
The map was sorted by pointer comparison.
Needs a bit cleanup, though.
author | phoku@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sun, 12 Oct 2008 20:30:09 +0000 |
parents | 679ed3e15513 |
children | a46368b3d8a0 |
line wrap: on
line diff
--- a/engine/core/util/resource/pool.cpp Sun Oct 12 19:23:10 2008 +0000 +++ b/engine/core/util/resource/pool.cpp Sun Oct 12 20:30:09 2008 +0000 @@ -87,22 +87,23 @@ m_loaders.push_back(loader); } - int Pool::addResourceFromLocation(const ResourceLocation& loc) { + 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; + return it->second; } PoolEntry* entry = new PoolEntry(); - entry->location = loc.clone(); + entry->location = loc->clone(); m_entries.push_back(entry); size_t index = m_entries.size() - 1; - m_location_to_entry[loc] = index; + m_location_to_entry[entry->location] = index; return index; } int Pool::addResourceFromFile(const std::string& filename) { - return addResourceFromLocation(ResourceLocation(filename)); + ResourceLocation r = ResourceLocation(filename); + return addResourceFromLocation(&r); } IResource& Pool::get(unsigned int index, bool inc) {