summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-03 21:06:10 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-03 21:06:10 +0300
commitbe5390833be676363630fcf69e81c838ba52bac2 (patch)
tree88a7a1f91ad275261122be67b2640944140bdc4e
parent4dc93e343e0fb4990320e1056bca666e8ce8c3d9 (diff)
downloadmanaverse-be5390833be676363630fcf69e81c838ba52bac2.tar.gz
manaverse-be5390833be676363630fcf69e81c838ba52bac2.tar.bz2
manaverse-be5390833be676363630fcf69e81c838ba52bac2.tar.xz
manaverse-be5390833be676363630fcf69e81c838ba52bac2.zip
Partial fix for working without resource caching.
-rw-r--r--src/resources/resourcemanager.cpp10
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())
{