summaryrefslogtreecommitdiff
path: root/src/resources/animation
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-06 23:34:34 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-07 19:23:40 +0300
commit36ba43d6ea38062b17f7e63ef659962bfc51c64d (patch)
tree190156cb88b13a38a6d13c69ee0742cc078065a1 /src/resources/animation
parentf1518dd8476c968a43fa57cfb06198e290a4f77a (diff)
downloadplus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.gz
plus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.bz2
plus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.xz
plus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.zip
Fix clang-tidy check readability-implicit-bool-cast.
Diffstat (limited to 'src/resources/animation')
-rw-r--r--src/resources/animation/animation.cpp2
-rw-r--r--src/resources/animation/simpleanimation.cpp30
2 files changed, 16 insertions, 16 deletions
diff --git a/src/resources/animation/animation.cpp b/src/resources/animation/animation.cpp
index ff3883c0d..4f83161de 100644
--- a/src/resources/animation/animation.cpp
+++ b/src/resources/animation/animation.cpp
@@ -84,7 +84,7 @@ void Animation::setLastFrameDelay(const int delay) noexcept2
for (FramesRevIter it = mFrames.rbegin(), it_end = mFrames.rend();
it != it_end; ++ it)
{
- if ((*it).type == FrameType::ANIMATION && (*it).image)
+ if ((*it).type == FrameType::ANIMATION && ((*it).image != nullptr))
{
(*it).delay = delay;
break;
diff --git a/src/resources/animation/simpleanimation.cpp b/src/resources/animation/simpleanimation.cpp
index 7f20b5eef..ed92d2b50 100644
--- a/src/resources/animation/simpleanimation.cpp
+++ b/src/resources/animation/simpleanimation.cpp
@@ -43,7 +43,7 @@ SimpleAnimation::SimpleAnimation(Animation *const animation) :
mAnimation(animation),
mAnimationTime(0),
mAnimationPhase(0),
- mCurrentFrame(mAnimation ? &mAnimation->mFrames[0] : nullptr),
+ mCurrentFrame(mAnimation != nullptr ? &mAnimation->mFrames[0] : nullptr),
mInitialized(true),
mImageSet(nullptr)
{
@@ -59,7 +59,7 @@ SimpleAnimation::SimpleAnimation(XmlNodeConstPtr animationNode,
mImageSet(nullptr)
{
initializeAnimation(animationNode, dyePalettes);
- if (mAnimation)
+ if (mAnimation != nullptr)
mCurrentFrame = &mAnimation->mFrames[0];
else
mCurrentFrame = nullptr;
@@ -68,7 +68,7 @@ SimpleAnimation::SimpleAnimation(XmlNodeConstPtr animationNode,
SimpleAnimation::~SimpleAnimation()
{
delete2(mAnimation);
- if (mImageSet)
+ if (mImageSet != nullptr)
{
mImageSet->decRef();
mImageSet = nullptr;
@@ -79,7 +79,7 @@ void SimpleAnimation::draw(Graphics *const graphics,
const int posX, const int posY) const
{
FUNC_BLOCK("SimpleAnimation::draw", 1)
- if (!mCurrentFrame || !mCurrentFrame->image)
+ if ((mCurrentFrame == nullptr) || (mCurrentFrame->image == nullptr))
return;
graphics->drawImage(mCurrentFrame->image,
@@ -95,7 +95,7 @@ void SimpleAnimation::reset()
void SimpleAnimation::setFrame(int frame)
{
- if (!mAnimation)
+ if (mAnimation == nullptr)
return;
if (frame < 0)
@@ -109,7 +109,7 @@ void SimpleAnimation::setFrame(int frame)
bool SimpleAnimation::update(const int timePassed)
{
- if (!mCurrentFrame || !mAnimation || !mInitialized)
+ if ((mCurrentFrame == nullptr) || (mAnimation == nullptr) || !mInitialized)
return false;
bool updated(false);
@@ -131,7 +131,7 @@ bool SimpleAnimation::update(const int timePassed)
int SimpleAnimation::getLength() const
{
- if (!mAnimation)
+ if (mAnimation == nullptr)
return 0;
return CAST_S32(mAnimation->getLength());
@@ -139,7 +139,7 @@ int SimpleAnimation::getLength() const
Image *SimpleAnimation::getCurrentImage() const
{
- if (mCurrentFrame)
+ if (mCurrentFrame != nullptr)
return mCurrentFrame->image;
else
return nullptr;
@@ -150,7 +150,7 @@ void SimpleAnimation::initializeAnimation(XmlNodeConstPtr animationNode,
{
mInitialized = false;
- if (!animationNode)
+ if (animationNode == nullptr)
return;
std::string imagePath = XML::getProperty(
@@ -165,7 +165,7 @@ void SimpleAnimation::initializeAnimation(XmlNodeConstPtr animationNode,
XML::getProperty(animationNode, "width", 0),
XML::getProperty(animationNode, "height", 0));
- if (!imageset)
+ if (imageset == nullptr)
return;
const int x1 = imageset->getWidth() / 2 - mapTileSize / 2;
@@ -192,13 +192,13 @@ void SimpleAnimation::initializeAnimation(XmlNodeConstPtr animationNode,
Image *const img = imageset->get(index);
- if (!img)
+ if (img == nullptr)
{
reportAlways("No image at index %d", index);
continue;
}
- if (mAnimation)
+ if (mAnimation != nullptr)
mAnimation->addFrame(img, delay, offsetX, offsetY, rand);
}
else if (xmlNameEqual(frameNode, "sequence"))
@@ -216,20 +216,20 @@ void SimpleAnimation::initializeAnimation(XmlNodeConstPtr animationNode,
{
Image *const img = imageset->get(start);
- if (!img)
+ if (img == nullptr)
{
reportAlways("No image at index %d", start);
continue;
}
- if (mAnimation)
+ if (mAnimation != nullptr)
mAnimation->addFrame(img, delay, offsetX, offsetY, rand);
start++;
}
}
else if (xmlNameEqual(frameNode, "end"))
{
- if (mAnimation)
+ if (mAnimation != nullptr)
mAnimation->addTerminator(rand);
}
}