summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-07-17 23:26:59 +0300
committerAndrei Karas <akaras@inbox.ru>2012-07-17 23:26:59 +0300
commit7e0a97d2521b9ce57003176e82a0b5564aa003c2 (patch)
tree5b2cfe1afe09bea1063f783050c1fb549daee76d /src/resources
parentf68cbf700a99f2f184715a5b8025bcb4b6525391 (diff)
downloadplus-7e0a97d2521b9ce57003176e82a0b5564aa003c2.tar.gz
plus-7e0a97d2521b9ce57003176e82a0b5564aa003c2.tar.bz2
plus-7e0a97d2521b9ce57003176e82a0b5564aa003c2.tar.xz
plus-7e0a97d2521b9ce57003176e82a0b5564aa003c2.zip
Fix more code style and additional warnings.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/dye.cpp5
-rw-r--r--src/resources/monsterdb.cpp3
-rw-r--r--src/resources/openglimagehelper.cpp6
-rw-r--r--src/resources/openglimagehelper.h2
-rw-r--r--src/resources/sdlimagehelper.cpp6
5 files changed, 13 insertions, 9 deletions
diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp
index 316dff9f3..df26ec1b7 100644
--- a/src/resources/dye.cpp
+++ b/src/resources/dye.cpp
@@ -54,8 +54,9 @@ DyePalette::DyePalette(const std::string &description, int8_t blockSize)
for (int i = 0, colorIdx = 0; i < blockSize && colorIdx < dyePalateSize;
i +=2, colorIdx ++)
{
- color.value[colorIdx] = (hexDecode(description[pos + i]) << 4)
- + hexDecode(description[pos + i + 1]);
+ color.value[colorIdx] = static_cast<unsigned char>((
+ hexDecode(description[pos + i]) << 4)
+ + hexDecode(description[pos + i + 1]));
}
mColors.push_back(color);
pos += blockSize;
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp
index d76585fd2..427db8f19 100644
--- a/src/resources/monsterdb.cpp
+++ b/src/resources/monsterdb.cpp
@@ -106,7 +106,8 @@ void MonsterDB::load()
else if (walkStr == "walkswim" || walkStr == "swimwalk")
block = Map::BLOCKMASK_AIR;
- currentInfo->setWalkMask(Map::BLOCKMASK_WALL | block);
+ currentInfo->setWalkMask(static_cast<unsigned char>(
+ Map::BLOCKMASK_WALL | block));
if (currentInfo->getMaxHP())
currentInfo->setStaticMaxHP(true);
diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp
index aec68f32a..ae3b55741 100644
--- a/src/resources/openglimagehelper.cpp
+++ b/src/resources/openglimagehelper.cpp
@@ -125,7 +125,7 @@ Resource *OpenGLImageHelper::load(SDL_RWops *rw, Dye const &dye)
Image *OpenGLImageHelper::load(SDL_Surface *tmpImage)
{
- return _GLload(tmpImage);
+ return glLoad(tmpImage);
}
Image *OpenGLImageHelper::createTextSurface(SDL_Surface *tmpImage, float alpha)
@@ -133,7 +133,7 @@ Image *OpenGLImageHelper::createTextSurface(SDL_Surface *tmpImage, float alpha)
if (!tmpImage)
return nullptr;
- Image *img = _GLload(tmpImage);
+ Image *img = glLoad(tmpImage);
if (img)
img->setAlpha(alpha);
return img;
@@ -155,7 +155,7 @@ int OpenGLImageHelper::powerOfTwo(int input)
return value >= mTextureSize ? mTextureSize : value;
}
-Image *OpenGLImageHelper::_GLload(SDL_Surface *tmpImage)
+Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage)
{
if (!tmpImage)
return nullptr;
diff --git a/src/resources/openglimagehelper.h b/src/resources/openglimagehelper.h
index b27409040..edba4cdef 100644
--- a/src/resources/openglimagehelper.h
+++ b/src/resources/openglimagehelper.h
@@ -112,7 +112,7 @@ class OpenGLImageHelper : public ImageHelper
*/
int powerOfTwo(int input);
- Image *_GLload(SDL_Surface *tmpImage);
+ Image *glLoad(SDL_Surface *tmpImage);
static int mUseOpenGL;
static int mTextureSize;
diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp
index 78094b211..5463abfeb 100644
--- a/src/resources/sdlimagehelper.cpp
+++ b/src/resources/sdlimagehelper.cpp
@@ -154,7 +154,8 @@ Image *SDLImageHelper::createTextSurface(SDL_Surface *tmpImage, float alpha)
uint32_t c = (static_cast<uint32_t*>(tmpImage->pixels))[i];
unsigned v = (c & fmt->Amask) >> fmt->Ashift;
- uint8_t a = (v << fmt->Aloss) + (v >> (8 - (fmt->Aloss << 1)));
+ uint8_t a = static_cast<uint8_t>((v << fmt->Aloss)
+ + (v >> (8 - (fmt->Aloss << 1))));
uint8_t a2 = static_cast<uint8_t>(static_cast<float>(a) * alpha);
@@ -241,7 +242,8 @@ Image *SDLImageHelper::_SDLload(SDL_Surface *tmpImage)
{
unsigned v = ((static_cast<uint32_t*>(tmpImage->pixels))[i]
& fmt->Amask) >> fmt->Ashift;
- uint8_t a = (v << fmt->Aloss) + (v >> (8 - (fmt->Aloss << 1)));
+ uint8_t a = static_cast<uint8_t>((v << fmt->Aloss)
+ + (v >> (8 - (fmt->Aloss << 1))));
if (a != 255)
hasAlpha = true;