diff engine/core/util/resource/pool.h @ 146:54b3984e1afc

The getIndex function was a hack that shadowed another bug that caused the pools to misbehave. AddResourceFromFile works now exactly as getIndex, it's just faster. Fixed GUIImage to not hold a reference, it uses the index directly anyway. Plus heaps of minor adjustments for more informative debug output and statistics.
author phoku@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 09 Oct 2008 12:36:21 +0000
parents 69a7d40ccf62
children fb6ccb367dd1
line wrap: on
line diff
--- a/engine/core/util/resource/pool.h	Thu Oct 09 08:23:13 2008 +0000
+++ b/engine/core/util/resource/pool.h	Thu Oct 09 12:36:21 2008 +0000
@@ -67,7 +67,7 @@
 
 		/** Default constructor.
 		 */
-		Pool();
+		Pool(const std::string& name);
 
 		/** Destructor.
 		 */
@@ -100,7 +100,7 @@
 		/** Gets resource index from pool with given filename
 		 * The resource will be created if it is not in the pool
 		 */
-		virtual unsigned int getIndex(const std::string& filename);
+		virtual int getIndex(const std::string& filename);
 
 		/** Removes the resource from pool if reference counter is null
 		 * 
@@ -150,12 +150,14 @@
 		};
 
 		void findAndSetProvider(PoolEntry& entry);
+
 		std::vector<PoolEntry*> m_entries;
 		typedef std::map<ResourceLocation, int> ResourceLocationToEntry;
 		ResourceLocationToEntry m_location_to_entry;
 		std::vector<IPoolListener*> m_listeners;
 		std::vector<ResourceLoader*> m_loaders;
 		int m_curind;
+		std::string m_name;
 	};
 
 } // FIFE