summaryrefslogtreecommitdiff
path: root/src/resources/atlasmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-26 01:57:54 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-30 02:57:14 +0300
commit29ad6702ab90fc75fe9d0422609609fd15123fc3 (patch)
tree0b9cee6f48b0dd28455e5ef86800efc30f38064d /src/resources/atlasmanager.cpp
parent660dcd09eb2c156e3ca8bafe0c1a339041204d33 (diff)
downloadmv-29ad6702ab90fc75fe9d0422609609fd15123fc3.tar.gz
mv-29ad6702ab90fc75fe9d0422609609fd15123fc3.tar.bz2
mv-29ad6702ab90fc75fe9d0422609609fd15123fc3.tar.xz
mv-29ad6702ab90fc75fe9d0422609609fd15123fc3.zip
Some error fixes in atlases.
Check if image already in cache and check for mapinfo before using it.
Diffstat (limited to 'src/resources/atlasmanager.cpp')
-rw-r--r--src/resources/atlasmanager.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/resources/atlasmanager.cpp b/src/resources/atlasmanager.cpp
index 770e43412..401dba0cb 100644
--- a/src/resources/atlasmanager.cpp
+++ b/src/resources/atlasmanager.cpp
@@ -92,10 +92,18 @@ AtlasResource *AtlasManager::loadTextureAtlas(const std::string &name,
void AtlasManager::loadImages(const StringVect &files,
std::vector<Image*> &images)
{
+ const ResourceManager *const resman = ResourceManager::getInstance();
+
for (StringVectCIter it = files.begin(), it_end = files.end();
it != it_end; ++ it)
{
const std::string str = *it;
+ if (resman->isInCache(str))
+ {
+ logger->log("Resource %s already in cache", str.c_str());
+ continue;
+ }
+
SDL_RWops *rw = PHYSFSRWOPS_openRead(str.c_str());
Image *image = sdlImageHelper->load(rw);
if (image)