Mercurial > fife-parpg
diff engine/core/util/resource/pool.h @ 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 | 54bfd1015b35 |
line wrap: on
line diff
--- a/engine/core/util/resource/pool.h Sun Oct 12 19:23:10 2008 +0000 +++ b/engine/core/util/resource/pool.h Sun Oct 12 20:30:09 2008 +0000 @@ -40,6 +40,13 @@ namespace FIFE { + struct ResourceLocationComparator { + bool operator()(const ResourceLocation* r1, const ResourceLocation* r2) const + { + return r1->operator<(*r2); + } + }; + class IResource; enum { RES_LOADED = 0x01, RES_NON_LOADED = 0x02}; @@ -73,7 +80,7 @@ /** Adds new resource into the pool using the given location. * @return The index of the resource in the pool. */ - virtual int addResourceFromLocation(const ResourceLocation& loc); + virtual int addResourceFromLocation(ResourceLocation* loc); /** This is a convenience version of addResourceFromLocation(). * It converts the filename into a ResourceLocation and then @@ -144,7 +151,7 @@ void findAndSetProvider(PoolEntry& entry); std::vector<PoolEntry*> m_entries; - typedef std::map<ResourceLocation, int> ResourceLocationToEntry; + typedef std::map<ResourceLocation*, int, ResourceLocationComparator> ResourceLocationToEntry; ResourceLocationToEntry m_location_to_entry; std::vector<ResourceLoader*> m_loaders; std::string m_name;