summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-04-30 19:52:34 +0300
committerAndrei Karas <akaras@inbox.ru>2014-04-30 19:52:34 +0300
commitdc569bbcb4c12a5a400f9e5701e5c1027badadae (patch)
tree9b502cafda345e7fb4b0342de97c77822544d9fd /src/resources
parent88c6a0aa757df0ec38bc67f2cf314f8be3efd0ce (diff)
downloadmv-dc569bbcb4c12a5a400f9e5701e5c1027badadae.tar.gz
mv-dc569bbcb4c12a5a400f9e5701e5c1027badadae.tar.bz2
mv-dc569bbcb4c12a5a400f9e5701e5c1027badadae.tar.xz
mv-dc569bbcb4c12a5a400f9e5701e5c1027badadae.zip
Fix code style in resources.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/ambientlayer.cpp4
-rw-r--r--src/resources/atlasmanager.cpp18
-rw-r--r--src/resources/db/deaddb.cpp2
-rw-r--r--src/resources/db/itemdb.cpp18
-rw-r--r--src/resources/dye.cpp8
-rw-r--r--src/resources/iteminfo.h2
-rw-r--r--src/resources/mapreader.cpp3
-rw-r--r--src/resources/resourcemanager.cpp10
-rw-r--r--src/resources/sdlmusic.h2
9 files changed, 43 insertions, 24 deletions
diff --git a/src/resources/ambientlayer.cpp b/src/resources/ambientlayer.cpp
index b839064be..6f760fe9d 100644
--- a/src/resources/ambientlayer.cpp
+++ b/src/resources/ambientlayer.cpp
@@ -101,8 +101,8 @@ void AmbientLayer::update(const int timePassed, const float dx, const float dy)
mPosY += dy * mParallaxY;
const SDL_Rect &rect = mImage->mBounds;
- const float imgW = rect.w;
- const float imgH = rect.h;
+ const float imgW = static_cast<float>(rect.w);
+ const float imgH = static_cast<float>(rect.h);
// Wrap values
while (mPosX > imgW)
diff --git a/src/resources/atlasmanager.cpp b/src/resources/atlasmanager.cpp
index 90aea108d..c3ba82fdd 100644
--- a/src/resources/atlasmanager.cpp
+++ b/src/resources/atlasmanager.cpp
@@ -202,15 +202,15 @@ void AtlasManager::simpleSort(const std::string &restrict name,
SDL_Surface *AtlasManager::createSDLAtlas(TextureAtlas *const atlas)
{
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- const int rmask = 0xff000000;
- const int gmask = 0x00ff0000;
- const int bmask = 0x0000ff00;
- const int amask = 0x000000ff;
+ const unsigned int rmask = 0xff000000;
+ const unsigned int gmask = 0x00ff0000;
+ const unsigned int bmask = 0x0000ff00;
+ const unsigned int amask = 0x000000ff;
#else
- const int rmask = 0x000000ff;
- const int gmask = 0x0000ff00;
- const int bmask = 0x00ff0000;
- const int amask = 0xff000000;
+ const unsigned int rmask = 0x000000ff;
+ const unsigned int gmask = 0x0000ff00;
+ const unsigned int bmask = 0x00ff0000;
+ const unsigned int amask = 0xff000000;
#endif
// do not create atlas based on only one image
@@ -225,7 +225,7 @@ SDL_Surface *AtlasManager::createSDLAtlas(TextureAtlas *const atlas)
const int height = atlas->height;
// temp SDL surface for atlas
SDL_Surface *const surface = MSDL_CreateRGBSurface(SDL_SWSURFACE,
- width, height, 32, rmask, gmask, bmask, amask);
+ width, height, 32U, rmask, gmask, bmask, amask);
if (!surface)
return nullptr;
diff --git a/src/resources/db/deaddb.cpp b/src/resources/db/deaddb.cpp
index e66e87e6a..7ee041cf2 100644
--- a/src/resources/db/deaddb.cpp
+++ b/src/resources/db/deaddb.cpp
@@ -89,7 +89,7 @@ void DeadDB::unload()
std::string DeadDB::getRandomString()
{
- const int sz = mMessages.size();
+ const size_t sz = mMessages.size();
if (!sz)
return std::string();
return translator->getStr(mMessages[rand() % sz]);
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp
index 09a5ce08f..939568f29 100644
--- a/src/resources/db/itemdb.cpp
+++ b/src/resources/db/itemdb.cpp
@@ -67,6 +67,24 @@ namespace
{
struct FieldType
{
+/*
+ FieldType() :
+ name(nullptr),
+ description(nullptr),
+ sign(false)
+ { }
+*/
+
+ FieldType(const char *const name0,
+ const char *const description0,
+ const bool sign0) :
+ name(name0),
+ description(description0),
+ sign(sign0)
+ { }
+
+ A_DELETE_COPY(FieldType)
+
const char *name;
const char *description;
const bool sign;
diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp
index 7e6692c50..2baa2d12b 100644
--- a/src/resources/dye.cpp
+++ b/src/resources/dye.cpp
@@ -203,7 +203,7 @@ void DyePalette::replaceSColor(uint32_t *restrict pixels,
const int bufSize) const
{
std::vector<DyeColor>::const_iterator it_end = mColors.end();
- const int sz = mColors.size();
+ const size_t sz = mColors.size();
if (!sz)
return;
if (sz % 2)
@@ -260,7 +260,7 @@ void DyePalette::replaceAColor(uint32_t *restrict pixels,
const int bufSize) const
{
std::vector<DyeColor>::const_iterator it_end = mColors.end();
- const int sz = mColors.size();
+ const size_t sz = mColors.size();
if (!sz)
return;
if (sz % 2)
@@ -304,7 +304,7 @@ void DyePalette::replaceSOGLColor(uint32_t *restrict pixels,
const int bufSize) const
{
std::vector<DyeColor>::const_iterator it_end = mColors.end();
- const int sz = mColors.size();
+ const size_t sz = mColors.size();
if (!sz)
return;
if (sz % 2)
@@ -354,7 +354,7 @@ void DyePalette::replaceAOGLColor(uint32_t *restrict pixels,
const int bufSize) const
{
std::vector<DyeColor>::const_iterator it_end = mColors.end();
- const int sz = mColors.size();
+ const size_t sz = mColors.size();
if (!sz)
return;
if (sz % 2)
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index d3df1c448..93a2d447f 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -298,7 +298,7 @@ class ItemInfo final
{ return mProtected; }
int getColorsSize() const
- { return mColors ? mColors->size() : 0; }
+ { return mColors ? static_cast<int>(mColors->size()) : 0; }
std::string getColorName(const int idx) const;
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index e16d1d850..ec219886e 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -524,7 +524,8 @@ inline static void setTile(Map *const map, MapLayer *const layer,
break;
if (map->getVersion() >= 2)
{
- heights->setHeight(x, y, gid - set->getFirstGid() + 1);
+ heights->setHeight(x, y, static_cast<uint8_t>(
+ gid - set->getFirstGid() + 1));
}
else
{
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 4eca5552e..a65fc508c 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -599,15 +599,15 @@ struct DyedImageLoader
if (!rl->manager)
return nullptr;
- std::string path = rl->path;
- const size_t p = path.find('|');
+ std::string path1 = rl->path;
+ const size_t p = path1.find('|');
Dye *d = nullptr;
if (p != std::string::npos)
{
- d = new Dye(path.substr(p + 1));
- path = path.substr(0, p);
+ d = new Dye(path1.substr(p + 1));
+ path1 = path1.substr(0, p);
}
- SDL_RWops *const rw = MPHYSFSRWOPS_openRead(path.c_str());
+ SDL_RWops *const rw = MPHYSFSRWOPS_openRead(path1.c_str());
if (!rw)
{
delete d;
diff --git a/src/resources/sdlmusic.h b/src/resources/sdlmusic.h
index 02f168522..589bc93a5 100644
--- a/src/resources/sdlmusic.h
+++ b/src/resources/sdlmusic.h
@@ -74,7 +74,7 @@ class SDLMusic final : public Resource
/**
* Constructor.
*/
- explicit SDLMusic(Mix_Music *const music, SDL_RWops *const rw);
+ SDLMusic(Mix_Music *const music, SDL_RWops *const rw);
Mix_Music *mMusic;
SDL_RWops *mRw;