From 36ba43d6ea38062b17f7e63ef659962bfc51c64d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 6 Jun 2017 23:34:34 +0300 Subject: Fix clang-tidy check readability-implicit-bool-cast. --- src/particle/particleengine.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/particle/particleengine.cpp') diff --git a/src/particle/particleengine.cpp b/src/particle/particleengine.cpp index 2ac1d7166..51620a11e 100644 --- a/src/particle/particleengine.cpp +++ b/src/particle/particleengine.cpp @@ -70,7 +70,7 @@ void ParticleEngine::setupEngine() restrict2 ParticleEngine::fastPhysics = config.getIntValue("particleFastPhysics"); ParticleEngine::emitterSkip = config.getIntValue("particleEmitterSkip") + 1; - if (!ParticleEngine::emitterSkip) + if (ParticleEngine::emitterSkip == 0) ParticleEngine::emitterSkip = 1; ParticleEngine::enabled = config.getBoolValue("particleeffects"); logger->log1("Particle engine set up"); @@ -78,7 +78,7 @@ void ParticleEngine::setupEngine() restrict2 bool ParticleEngine::update() restrict2 { - if (mChildParticles.empty() || !mMap) + if (mChildParticles.empty() || (mMap == nullptr)) return true; // Update child particles @@ -139,12 +139,12 @@ Particle *ParticleEngine::addEffect(const std::string &restrict particleEffectFile.substr(0, pos), UseVirtFs_true, SkipError_false); - if (!doc) + if (doc == nullptr) return nullptr; XmlNodeConstPtrConst rootNode = doc->rootNode(); - if (!rootNode || !xmlNameEqual(rootNode, "effect")) + if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "effect")) { logger->log("Error loading particle: %s", particleEffectFile.c_str()); doc->decRef(); @@ -162,20 +162,22 @@ Particle *ParticleEngine::addEffect(const std::string &restrict XmlNodePtr node; // Animation - if ((node = XML::findFirstChildByName(effectChildNode, "animation"))) + if ((node = XML::findFirstChildByName(effectChildNode, "animation")) != + nullptr) { newParticle = new AnimationParticle(node, dyePalettes); newParticle->setMap(mMap); } // Rotational else if ((node = XML::findFirstChildByName( - effectChildNode, "rotation"))) + effectChildNode, "rotation")) != nullptr) { newParticle = new RotationalParticle(node, dyePalettes); newParticle->setMap(mMap); } // Image - else if ((node = XML::findFirstChildByName(effectChildNode, "image"))) + else if ((node = XML::findFirstChildByName(effectChildNode, + "image")) != nullptr) { std::string imageSrc; if (XmlHaveChildContent(node)) @@ -230,7 +232,7 @@ Particle *ParticleEngine::addEffect(const std::string &restrict else if (xmlNameEqual(emitterNode, "deatheffect")) { std::string deathEffect; - if (node && XmlHaveChildContent(node)) + if ((node != nullptr) && XmlHaveChildContent(node)) deathEffect = XmlChildContent(emitterNode); char deathEffectConditions = 0x00; -- cgit v1.2.3-70-g09d2