diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-09-28 20:56:26 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-09-28 20:56:26 +0300 |
commit | d10d5deee3f67c93e8d6d2a4db437e2b6cf9ecd4 (patch) | |
tree | 9de4498251afffce501b5eb1f289cf3379957e8c /src/resources | |
parent | 5986e192171faa3f7a1422b1f8fd3e561ed5f693 (diff) | |
download | mv-d10d5deee3f67c93e8d6d2a4db437e2b6cf9ecd4.tar.gz mv-d10d5deee3f67c93e8d6d2a4db437e2b6cf9ecd4.tar.bz2 mv-d10d5deee3f67c93e8d6d2a4db437e2b6cf9ecd4.tar.xz mv-d10d5deee3f67c93e8d6d2a4db437e2b6cf9ecd4.zip |
Change deleted resource list from map to vector.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/resourcemanager.cpp | 14 | ||||
-rw-r--r-- | src/resources/resourcemanager.h | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index f398c4b45..9c9bb3b32 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -67,7 +67,7 @@ ResourceManager::~ResourceManager() { mDestruction = true; mResources.insert(mOrphanedResources.begin(), mOrphanedResources.end()); - mResources.insert(mDeletedResources.begin(), mDeletedResources.end()); +// mResources.insert(mDeletedResources.begin(), mDeletedResources.end()); // Release any remaining spritedefs first because they depend on image sets ResourceIterator iter = mResources.begin(); @@ -673,16 +673,16 @@ void ResourceManager::release(Resource *const res) if (!res || mDestruction) return; - ResourceIterator resIter = mDeletedResources.find(res->mIdPath); - if (resIter != mDeletedResources.end() && resIter->second == res) + std::set<Resource*>::iterator resDelIter = mDeletedResources.find(res); + if (resDelIter != mDeletedResources.end()) { // we found zero counted image in deleted list. deleting it and exit. - mDeletedResources.erase(resIter); + mDeletedResources.erase(resDelIter); delete res; return; } - resIter = mResources.find(res->mIdPath); + ResourceIterator resIter = mResources.find(res->mIdPath); // The resource has to exist assert(resIter != mResources.end() && resIter->second == res); @@ -707,13 +707,13 @@ void ResourceManager::moveToDeleted(Resource *const res) ResourceIterator resIter = mResources.find(res->mIdPath); if (resIter != mResources.end() && resIter->second == res) { - mDeletedResources.insert(*resIter); + mDeletedResources.insert(res); mResources.erase(resIter); } resIter = mOrphanedResources.find(res->mIdPath); if (resIter != mOrphanedResources.end() && resIter->second == res) { - mDeletedResources.insert(*resIter); + mDeletedResources.insert(res); mOrphanedResources.erase(resIter); } } diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h index 2c9fbe3eb..e20e4b3ac 100644 --- a/src/resources/resourcemanager.h +++ b/src/resources/resourcemanager.h @@ -312,7 +312,7 @@ class ResourceManager final std::set<SDL_Surface*> deletedSurfaces; Resources mResources; Resources mOrphanedResources; - Resources mDeletedResources; + std::set<Resource*> mDeletedResources; time_t mOldestOrphan; std::string mSelectedSkin; std::string mSkinName; |