diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-03 21:06:10 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-03 21:06:10 +0300 |
commit | be5390833be676363630fcf69e81c838ba52bac2 (patch) | |
tree | 88a7a1f91ad275261122be67b2640944140bdc4e | |
parent | 4dc93e343e0fb4990320e1056bca666e8ce8c3d9 (diff) | |
download | manaplus-be5390833be676363630fcf69e81c838ba52bac2.tar.gz manaplus-be5390833be676363630fcf69e81c838ba52bac2.tar.bz2 manaplus-be5390833be676363630fcf69e81c838ba52bac2.tar.xz manaplus-be5390833be676363630fcf69e81c838ba52bac2.zip |
Partial fix for working without resource caching.
-rw-r--r-- | src/resources/resourcemanager.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index ba23e4ac2..f67bbf71b 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -492,7 +492,6 @@ Resource *ResourceManager::get(const std::string &idPath, const generator fun, Resource *resource = getFromCache(idPath); if (resource) return resource; - resource = fun(data); if (resource) @@ -509,7 +508,12 @@ Resource *ResourceManager::get(const std::string &idPath, const generator fun, #else Resource *resource = fun(data); - if (!resource) + if (resource) + { + resource->incRef(); + resource->mIdPath = idPath; + } + else { logger->log("Error loaging image: " + idPath); } @@ -768,10 +772,10 @@ SpriteDef *ResourceManager::getSprite(const std::string &path, void ResourceManager::release(Resource *const res) { -#ifndef DISABLE_RESOURCE_CACHING if (!res || mDestruction) return; +#ifndef DISABLE_RESOURCE_CACHING std::set<Resource*>::iterator resDelIter = mDeletedResources.find(res); if (resDelIter != mDeletedResources.end()) { |