diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-06-06 23:34:34 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-06-07 19:23:40 +0300 |
commit | 36ba43d6ea38062b17f7e63ef659962bfc51c64d (patch) | |
tree | 190156cb88b13a38a6d13c69ee0742cc078065a1 /src/resources/dye/dye.cpp | |
parent | f1518dd8476c968a43fa57cfb06198e290a4f77a (diff) | |
download | manaverse-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.gz manaverse-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.bz2 manaverse-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.xz manaverse-36ba43d6ea38062b17f7e63ef659962bfc51c64d.zip |
Fix clang-tidy check readability-implicit-bool-cast.
Diffstat (limited to 'src/resources/dye/dye.cpp')
-rw-r--r-- | src/resources/dye/dye.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/resources/dye/dye.cpp b/src/resources/dye/dye.cpp index b9c9e4cd8..70d2a21b1 100644 --- a/src/resources/dye/dye.cpp +++ b/src/resources/dye/dye.cpp @@ -143,9 +143,9 @@ void Dye::instantiate(std::string &restrict target, int Dye::getType() const restrict2 noexcept2 { - if (mDyePalettes[sPaleteIndex]) + if (mDyePalettes[sPaleteIndex] != nullptr) return 1; - if (mDyePalettes[aPaleteIndex]) + if (mDyePalettes[aPaleteIndex] != nullptr) return 2; return 0; } @@ -153,7 +153,7 @@ int Dye::getType() const restrict2 noexcept2 void Dye::normalDye(uint32_t *restrict pixels, const int bufSize) const restrict2 { - if (!pixels) + if (pixels == nullptr) return; #ifdef ENABLE_CILKPLUS @@ -230,7 +230,7 @@ endlabel:{} const int alpha = p & 0xff; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - if (!alpha) + if (alpha == 0) continue; unsigned int color[3]; #if SDL_BYTEORDER == SDL_BIG_ENDIAN @@ -260,10 +260,11 @@ endlabel:{} continue; } - const unsigned int i = (color[0] != 0) | ((color[1] != 0) << 1) - | ((color[2] != 0) << 2); + const unsigned int i = static_cast<int>(color[0] != 0) | + (static_cast<int>(color[1] != 0) << 1) | + (static_cast<int>(color[2] != 0) << 2); - if (mDyePalettes[i - 1]) + if (mDyePalettes[i - 1] != nullptr) mDyePalettes[i - 1]->getColor(cmax, color); #if SDL_BYTEORDER == SDL_BIG_ENDIAN @@ -281,7 +282,7 @@ endlabel:{} void Dye::normalOGLDye(uint32_t *restrict pixels, const int bufSize) const restrict2 { - if (!pixels) + if (pixels == nullptr) return; #ifdef ENABLE_CILKPLUS @@ -357,7 +358,7 @@ endlabel:{} const int alpha = p & 0xff000000; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - if (!alpha) + if (alpha == 0) continue; unsigned int color[3]; #if SDL_BYTEORDER == SDL_BIG_ENDIAN @@ -387,10 +388,11 @@ endlabel:{} continue; } - const unsigned int i = (color[0] != 0) | ((color[1] != 0) << 1) - | ((color[2] != 0) << 2); + const unsigned int i = static_cast<int>(color[0] != 0) | + (static_cast<int>(color[1] != 0) << 1) | + (static_cast<int>(color[2] != 0) << 2); - if (mDyePalettes[i - 1]) + if (mDyePalettes[i - 1] != nullptr) mDyePalettes[i - 1]->getColor(cmax, color); #if SDL_BYTEORDER == SDL_BIG_ENDIAN |