summaryrefslogtreecommitdiff
path: root/src/resources
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
parent538261b13990ee02bbc62d9704233885b15cee04 (diff)
downloadplus-ff5e17ff14a78af31d9d23cd1dfdb5404f9a8fa9.tar.gz
plus-ff5e17ff14a78af31d9d23cd1dfdb5404f9a8fa9.tar.bz2
plus-ff5e17ff14a78af31d9d23cd1dfdb5404f9a8fa9.tar.xz
plus-ff5e17ff14a78af31d9d23cd1dfdb5404f9a8fa9.zip
Fix code style with new tool.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/image.cpp10
-rw-r--r--src/resources/mapreader.cpp4
-rw-r--r--src/resources/resourcemanager.cpp54
-rw-r--r--src/resources/specialdb.cpp3
4 files changed, 35 insertions, 36 deletions
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index 6f9042029..0ac11f114 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -250,14 +250,14 @@ Image *Image::createTextSurface(SDL_Surface *tmpImage, float alpha)
// We also delete the alpha channel since
// it's not used.
- delete[] alphaChannel;
+ delete [] alphaChannel;
alphaChannel = nullptr;
}
if (!image)
{
logger->log1("Error: Image convert failed.");
- delete[] alphaChannel;
+ delete [] alphaChannel;
return nullptr;
}
@@ -295,7 +295,7 @@ void Image::unload()
SDL_FreeSurface(mSDLSurface);
mSDLSurface = nullptr;
- delete[] mAlphaChannel;
+ delete [] mAlphaChannel;
mAlphaChannel = nullptr;
}
@@ -689,14 +689,14 @@ Image *Image::_SDLload(SDL_Surface *tmpImage)
// We also delete the alpha channel since
// it's not used.
- delete[] alphaChannel;
+ delete [] alphaChannel;
alphaChannel = nullptr;
}
if (!image)
{
logger->log1("Error: Image convert failed.");
- delete[] alphaChannel;
+ delete [] alphaChannel;
return nullptr;
}
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 1ddb74f20..eec14685d 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -503,7 +503,7 @@ void MapReader::readLayer(XmlNodePtr node, Map *map)
const char *charStart = reinterpret_cast<const char*>(xmlChars);
if (!charStart)
{
- delete[] charData;
+ delete [] charData;
return;
}
@@ -526,7 +526,7 @@ void MapReader::readLayer(XmlNodePtr node, Map *map)
static_cast<int>(strlen(reinterpret_cast<char*>(
charData))), &binLen);
- delete[] charData;
+ delete [] charData;
xmlFree(xmlChars);
if (binData)
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;
}
diff --git a/src/resources/specialdb.cpp b/src/resources/specialdb.cpp
index b1a3a9c4d..664d2c73d 100644
--- a/src/resources/specialdb.cpp
+++ b/src/resources/specialdb.cpp
@@ -36,7 +36,7 @@ namespace
SpecialInfo::TargetMode SpecialDB::targetModeFromString(const std::string& str)
{
- if (str == "self") return SpecialInfo::TARGET_SELF;
+ if (str == "self") return SpecialInfo::TARGET_SELF;
else if (str == "friend") return SpecialInfo::TARGET_FRIEND;
else if (str == "enemy") return SpecialInfo::TARGET_ENEMY;
else if (str == "being") return SpecialInfo::TARGET_BEING;
@@ -131,4 +131,3 @@ SpecialInfo *SpecialDB::get(int id)
return i->second;
return nullptr;
}
-