From dffc4e4d8908f2df4eb458aa1a77c73c93213d43 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 30 Jun 2012 16:31:20 +0300 Subject: Add debug option with disabled images caching. --- src/resources/resourcemanager.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/resources/resourcemanager.cpp') diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index ffba339c8..9b5394687 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -391,6 +391,7 @@ Resource *ResourceManager::getFromCache(const std::string &idPath) Resource *ResourceManager::get(const std::string &idPath, generator fun, void *data) { +#ifndef DISABLE_RESOURCE_CACHING Resource *resource = getFromCache(idPath); if (resource) return resource; @@ -408,6 +409,14 @@ Resource *ResourceManager::get(const std::string &idPath, generator fun, { logger->log("Error loaging image: " + idPath); } +#else + Resource *resource = fun(data); + + if (!resource) + { + logger->log("Error loaging image: " + idPath); + } +#endif // Returns nullptr if the object could not be created. return resource; @@ -559,6 +568,7 @@ SpriteDef *ResourceManager::getSprite(const std::string &path, int variant) void ResourceManager::release(Resource *res) { +#ifndef DISABLE_RESOURCE_CACHING if (!res || mDestruction) return; @@ -577,6 +587,9 @@ void ResourceManager::release(Resource *res) mOrphanedResources.insert(*resIter); mResources.erase(resIter); +#else + delete res; +#endif } ResourceManager *ResourceManager::getInstance() -- cgit v1.2.3-70-g09d2