From eb8f621ab090595abbc3a7af58b788f3b58b573c Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 8 Jan 2014 10:47:27 +0800 Subject: [PATCH] closed #3597: Uses !xxx.empty() instead of xxx.size() > 0. --- cocos/2d/CCParticleSystem.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cocos/2d/CCParticleSystem.cpp b/cocos/2d/CCParticleSystem.cpp index aeda75ac68..f34e692792 100644 --- a/cocos/2d/CCParticleSystem.cpp +++ b/cocos/2d/CCParticleSystem.cpp @@ -351,13 +351,13 @@ bool ParticleSystem::initWithDictionary(ValueMap& dictionary, const std::string& { string textureDir = textureName.substr(0, rPos + 1); - if (dirname.size()>0 && textureDir != dirname) + if (!dirname.empty() && textureDir != dirname) { textureName = textureName.substr(rPos+1); textureName = dirname + textureName; } } - else if ( dirname.size()>0 && textureName.empty() == false) + else if (!dirname.empty() && !textureName.empty()) { textureName = dirname + textureName; } @@ -369,7 +369,7 @@ bool ParticleSystem::initWithDictionary(ValueMap& dictionary, const std::string& // set not pop-up message box when load image failed bool notify = FileUtils::getInstance()->isPopupNotify(); FileUtils::getInstance()->setPopupNotify(false); - tex = Director::getInstance()->getTextureCache()->addImage(textureName.c_str()); + tex = Director::getInstance()->getTextureCache()->addImage(textureName); // reset the value of UIImage notify FileUtils::getInstance()->setPopupNotify(notify); } @@ -406,10 +406,12 @@ bool ParticleSystem::initWithDictionary(ValueMap& dictionary, const std::string& image->release(); } } - if (_configName.length()>0) + + if (!_configName.empty()) { - _yCoordFlipped = dictionary["yCoordFlipped"].asInt(); + _yCoordFlipped = dictionary["yCoordFlipped"].asInt(); } + CCASSERT( this->_texture != nullptr, "CCParticleSystem: error loading the texture"); } ret = true;