diff options
Diffstat (limited to 'src/particleemitter.cpp')
-rw-r--r-- | src/particleemitter.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp index 1add452a0..c6c819e92 100644 --- a/src/particleemitter.cpp +++ b/src/particleemitter.cpp @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2006-2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011 The ManaPlus Developers + * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. * @@ -39,11 +39,11 @@ #define SIN45 0.707106781f #define DEG_RAD_FACTOR 0.017453293f -ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, +ParticleEmitter::ParticleEmitter(XmlNodePtr emitterNode, Particle *target, Map *map, int rotation, const std::string& dyePalettes): mOutputPauseLeft(0), - mParticleImage(0) + mParticleImage(nullptr) { mMap = map; mParticleTarget = target; @@ -71,7 +71,7 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, for_each_xml_child_node(propertyNode, emitterNode) { - if (xmlStrEqual(propertyNode->name, BAD_CAST "property")) + if (xmlNameEqual(propertyNode, "property")) { std::string name = XML::getProperty(propertyNode, "name", ""); @@ -197,13 +197,13 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, name.c_str()); } } - else if (xmlStrEqual(propertyNode->name, BAD_CAST "emitter")) + else if (xmlNameEqual(propertyNode, "emitter")) { ParticleEmitter newEmitter(propertyNode, mParticleTarget, map, rotation, dyePalettes); mParticleChildEmitters.push_back(newEmitter); } - else if (xmlStrEqual(propertyNode->name, BAD_CAST "rotation")) + else if (xmlNameEqual(propertyNode, "rotation")) { ImageSet *imageset = ResourceManager::getInstance()->getImageSet( XML::getProperty(propertyNode, "imageset", ""), @@ -229,7 +229,7 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, offsetY -= imageset->getHeight() - 32; offsetX -= imageset->getWidth() / 2 - 16; - if (xmlStrEqual(frameNode->name, BAD_CAST "frame")) + if (xmlNameEqual(frameNode, "frame")) { int index = XML::getProperty(frameNode, "index", -1); @@ -250,7 +250,7 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, mParticleRotation.addFrame(img, delay, offsetX, offsetY, rand); } - else if (xmlStrEqual(frameNode->name, BAD_CAST "sequence")) + else if (xmlNameEqual(frameNode, "sequence")) { int start = XML::getProperty(frameNode, "start", -1); int end = XML::getProperty(frameNode, "end", -1); @@ -276,13 +276,13 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, start++; } } - else if (xmlStrEqual(frameNode->name, BAD_CAST "end")) + else if (xmlNameEqual(frameNode, "end")) { mParticleRotation.addTerminator(rand); } } // for frameNode } - else if (xmlStrEqual(propertyNode->name, BAD_CAST "animation")) + else if (xmlNameEqual(propertyNode, "animation")) { ImageSet *imageset = ResourceManager::getInstance()->getImageSet( XML::getProperty(propertyNode, "imageset", ""), @@ -307,7 +307,7 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, offsetY -= imageset->getHeight() - 32; offsetX -= imageset->getWidth() / 2 - 16; - if (xmlStrEqual(frameNode->name, BAD_CAST "frame")) + if (xmlNameEqual(frameNode, "frame")) { int index = XML::getProperty(frameNode, "index", -1); @@ -328,7 +328,7 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, mParticleAnimation.addFrame(img, delay, offsetX, offsetY, rand); } - else if (xmlStrEqual(frameNode->name, BAD_CAST "sequence")) + else if (xmlNameEqual(frameNode, "sequence")) { int start = XML::getProperty(frameNode, "start", -1); int end = XML::getProperty(frameNode, "end", -1); @@ -354,13 +354,13 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, start++; } } - else if (xmlStrEqual(frameNode->name, BAD_CAST "end")) + else if (xmlNameEqual(frameNode, "end")) { mParticleAnimation.addTerminator(rand); } } // for frameNode } - else if (xmlStrEqual(propertyNode->name, BAD_CAST "deatheffect")) + else if (xmlNameEqual(propertyNode, "deatheffect")) { mDeathEffect = reinterpret_cast<const char*>( propertyNode->xmlChildrenNode->content); @@ -460,13 +460,13 @@ ParticleEmitter::~ParticleEmitter() if (mParticleImage) { mParticleImage->decRef(); - mParticleImage = 0; + mParticleImage = nullptr; } } template <typename T> ParticleEmitterProp<T> -ParticleEmitter::readParticleEmitterProp(xmlNodePtr propertyNode, T def) +ParticleEmitter::readParticleEmitterProp(XmlNodePtr propertyNode, T def) { ParticleEmitterProp<T> retval; |