summaryrefslogtreecommitdiff
path: root/src/particle/particle.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-10 18:30:46 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-10 18:35:33 +0300
commit7ba901978bf2f5ba96bd85d18c226490e39580c9 (patch)
treee616fa65cb7e9b64fa3e32fdf32f4e3ff8831b69 /src/particle/particle.cpp
parentfe8e481910ec72c9d70b00737f89d5780f1a3cc5 (diff)
downloadmanaplus-7ba901978bf2f5ba96bd85d18c226490e39580c9.tar.gz
manaplus-7ba901978bf2f5ba96bd85d18c226490e39580c9.tar.bz2
manaplus-7ba901978bf2f5ba96bd85d18c226490e39580c9.tar.xz
manaplus-7ba901978bf2f5ba96bd85d18c226490e39580c9.zip
Use xml loader in particle effects.
Diffstat (limited to 'src/particle/particle.cpp')
-rw-r--r--src/particle/particle.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp
index 9d755276d..11e36728b 100644
--- a/src/particle/particle.cpp
+++ b/src/particle/particle.cpp
@@ -38,6 +38,7 @@
#include "resources/image/image.h"
#include "resources/loaders/imageloader.h"
+#include "resources/loaders/xmlloader.h"
#include "utils/delete2.h"
#include "utils/dtor.h"
@@ -410,14 +411,17 @@ Particle *Particle::addEffect(const std::string &restrict particleEffectFile,
const size_t pos = particleEffectFile.find('|');
const std::string dyePalettes = (pos != std::string::npos)
? particleEffectFile.substr(pos + 1) : "";
- XML::Document doc(particleEffectFile.substr(0, pos),
+ XML::Document *doc = Loader::getXml(particleEffectFile.substr(0, pos),
UseResman_true,
SkipError_false);
- const XmlNodePtrConst rootNode = doc.rootNode();
+ if (!doc)
+ return nullptr;
+ const XmlNodePtrConst rootNode = doc->rootNode();
if (!rootNode || !xmlNameEqual(rootNode, "effect"))
{
logger->log("Error loading particle: %s", particleEffectFile.c_str());
+ doc->decRef();
return nullptr;
}
@@ -537,6 +541,7 @@ Particle *Particle::addEffect(const std::string &restrict particleEffectFile,
mChildParticles.push_back(newParticle);
}
+ doc->decRef();
return newParticle;
}