Merge pull request #4991 from dumganhar/iss3597-particle-plist

closed #3597:  Merge PR #4846
This commit is contained in:
James Chen 2014-01-07 18:49:24 -08:00
commit c964451f5f
2 changed files with 9 additions and 10 deletions

View File

@ -351,18 +351,15 @@ bool ParticleSystem::initWithDictionary(ValueMap& dictionary, const std::string&
{ {
string textureDir = textureName.substr(0, rPos + 1); string textureDir = textureName.substr(0, rPos + 1);
if (dirname.size()>0 && textureDir != dirname) if (!dirname.empty() && textureDir != dirname)
{ {
textureName = textureName.substr(rPos+1); textureName = textureName.substr(rPos+1);
textureName = dirname + textureName; textureName = dirname + textureName;
} }
} }
else else if (!dirname.empty() && !textureName.empty())
{ {
if (dirname.size()>0) textureName = dirname + textureName;
{
textureName = dirname + textureName;
}
} }
Texture2D *tex = nullptr; Texture2D *tex = nullptr;
@ -372,7 +369,7 @@ bool ParticleSystem::initWithDictionary(ValueMap& dictionary, const std::string&
// set not pop-up message box when load image failed // set not pop-up message box when load image failed
bool notify = FileUtils::getInstance()->isPopupNotify(); bool notify = FileUtils::getInstance()->isPopupNotify();
FileUtils::getInstance()->setPopupNotify(false); FileUtils::getInstance()->setPopupNotify(false);
tex = Director::getInstance()->getTextureCache()->addImage(textureName.c_str()); tex = Director::getInstance()->getTextureCache()->addImage(textureName);
// reset the value of UIImage notify // reset the value of UIImage notify
FileUtils::getInstance()->setPopupNotify(notify); FileUtils::getInstance()->setPopupNotify(notify);
} }
@ -409,10 +406,12 @@ bool ParticleSystem::initWithDictionary(ValueMap& dictionary, const std::string&
image->release(); 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"); CCASSERT( this->_texture != nullptr, "CCParticleSystem: error loading the texture");
} }
ret = true; ret = true;

View File

@ -106,7 +106,7 @@ public:
* If the filename was not previously loaded, it will create a new Texture2D * If the filename was not previously loaded, it will create a new Texture2D
* object and it will return it. It will use the filename as a key. * object and it will return it. It will use the filename as a key.
* Otherwise it will return a reference of a previously loaded image. * Otherwise it will return a reference of a previously loaded image.
* Supported image extensions: .png, .bmp, .tiff, .jpeg, .pvr, .gif * Supported image extensions: .png, .bmp, .tiff, .jpeg, .pvr
*/ */
Texture2D* addImage(const std::string &filepath); Texture2D* addImage(const std::string &filepath);