summaryrefslogtreecommitdiff
path: root/src/resources/resourcemanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-08 00:49:41 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-08 00:49:41 +0300
commitff5e17ff14a78af31d9d23cd1dfdb5404f9a8fa9 (patch)
tree51a99a43eba0b09ca9e5f554b3676d0308685797 /src/resources/resourcemanager.cpp
parent538261b13990ee02bbc62d9704233885b15cee04 (diff)
downloadmv-ff5e17ff14a78af31d9d23cd1dfdb5404f9a8fa9.tar.gz
mv-ff5e17ff14a78af31d9d23cd1dfdb5404f9a8fa9.tar.bz2
mv-ff5e17ff14a78af31d9d23cd1dfdb5404f9a8fa9.tar.xz
mv-ff5e17ff14a78af31d9d23cd1dfdb5404f9a8fa9.zip
Fix code style with new tool.
Diffstat (limited to 'src/resources/resourcemanager.cpp')
-rw-r--r--src/resources/resourcemanager.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index c26526b97..7adeaa268 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -404,19 +404,19 @@ struct ResourceLoader
{
if (!v)
return nullptr;
- ResourceLoader *l = static_cast< ResourceLoader * >(v);
- SDL_RWops *rw = PHYSFSRWOPS_openRead(l->path.c_str());
+ ResourceLoader *rl = static_cast< ResourceLoader * >(v);
+ SDL_RWops *rw = PHYSFSRWOPS_openRead(rl->path.c_str());
if (!rw)
return nullptr;
- Resource *res = l->fun(rw);
+ Resource *res = rl->fun(rw);
return res;
}
};
Resource *ResourceManager::load(const std::string &path, loader fun)
{
- ResourceLoader l = { this, path, fun };
- return get(path, ResourceLoader::load, &l);
+ ResourceLoader rl = { this, path, fun };
+ return get(path, ResourceLoader::load, &rl);
}
Music *ResourceManager::getMusic(const std::string &idPath)
@@ -438,11 +438,11 @@ struct DyedImageLoader
if (!v)
return nullptr;
- DyedImageLoader *l = static_cast< DyedImageLoader * >(v);
- if (!l->manager)
+ DyedImageLoader *rl = static_cast< DyedImageLoader * >(v);
+ if (!rl->manager)
return nullptr;
- std::string path = l->path;
+ std::string path = rl->path;
std::string::size_type p = path.find('|');
Dye *d = nullptr;
if (p != std::string::npos)
@@ -465,8 +465,8 @@ struct DyedImageLoader
Image *ResourceManager::getImage(const std::string &idPath)
{
- DyedImageLoader l = { this, idPath };
- return static_cast<Image*>(get(idPath, DyedImageLoader::load, &l));
+ DyedImageLoader rl = { this, idPath };
+ return static_cast<Image*>(get(idPath, DyedImageLoader::load, &rl));
}
/*
@@ -475,8 +475,8 @@ Image *ResourceManager::getSkinImage(const std::string &idPath)
if (mSelectedSkin.empty())
return getImage(idPath);
- DyedImageLoader l = { this, mSelectedSkin + idPath };
- void *ptr = get(idPath, DyedImageLoader::load, &l);
+ DyedImageLoader rl = { this, mSelectedSkin + idPath };
+ void *ptr = get(idPath, DyedImageLoader::load, &rl);
if (ptr)
return static_cast<Image*>(ptr);
else
@@ -494,14 +494,14 @@ struct ImageSetLoader
if (!v)
return nullptr;
- ImageSetLoader *l = static_cast< ImageSetLoader * >(v);
- if (!l->manager)
+ ImageSetLoader *rl = static_cast< ImageSetLoader * >(v);
+ if (!rl->manager)
return nullptr;
- Image *img = l->manager->getImage(l->path);
+ Image *img = rl->manager->getImage(rl->path);
if (!img)
return nullptr;
- ImageSet *res = new ImageSet(img, l->w, l->h);
+ ImageSet *res = new ImageSet(img, rl->w, rl->h);
img->decRef();
return res;
}
@@ -510,10 +510,10 @@ struct ImageSetLoader
ImageSet *ResourceManager::getImageSet(const std::string &imagePath,
int w, int h)
{
- ImageSetLoader l = { this, imagePath, w, h };
+ ImageSetLoader rl = { this, imagePath, w, h };
std::stringstream ss;
ss << imagePath << "[" << w << "x" << h << "]";
- return static_cast<ImageSet*>(get(ss.str(), ImageSetLoader::load, &l));
+ return static_cast<ImageSet*>(get(ss.str(), ImageSetLoader::load, &rl));
}
struct SpriteDefLoader
@@ -525,17 +525,17 @@ struct SpriteDefLoader
if (!v)
return nullptr;
- SpriteDefLoader *l = static_cast< SpriteDefLoader * >(v);
- return SpriteDef::load(l->path, l->variant);
+ SpriteDefLoader *rl = static_cast< SpriteDefLoader * >(v);
+ return SpriteDef::load(rl->path, rl->variant);
}
};
SpriteDef *ResourceManager::getSprite(const std::string &path, int variant)
{
- SpriteDefLoader l = { path, variant };
+ SpriteDefLoader rl = { path, variant };
std::stringstream ss;
ss << path << "[" << variant << "]";
- return static_cast<SpriteDef*>(get(ss.str(), SpriteDefLoader::load, &l));
+ return static_cast<SpriteDef*>(get(ss.str(), SpriteDefLoader::load, &rl));
}
void ResourceManager::release(Resource *res)
@@ -723,10 +723,10 @@ struct RescaledLoader
{
if (!v)
return nullptr;
- RescaledLoader *l = static_cast< RescaledLoader * >(v);
- if (!l->manager)
+ RescaledLoader *rl = static_cast< RescaledLoader * >(v);
+ if (!rl->manager || !rl->image)
return nullptr;
- Image *rescaled = l->image->SDLgetScaledImage(l->width, l->height);
+ Image *rescaled = rl->image->SDLgetScaledImage(rl->width, rl->height);
if (!rescaled)
return nullptr;
return rescaled;
@@ -740,7 +740,7 @@ Image *ResourceManager::getRescaled(Image *image, int width, int height)
std::string idPath = image->getIdPath() + strprintf(
"_rescaled%dx%d", width, height);
- RescaledLoader l = { this, image, width, height };
- Image *img = static_cast<Image*>(get(idPath, RescaledLoader::load, &l));
+ RescaledLoader rl = { this, image, width, height };
+ Image *img = static_cast<Image*>(get(idPath, RescaledLoader::load, &rl));
return img;
}