summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-01-10 21:06:33 +0300
committerAndrei Karas <akaras@inbox.ru>2012-01-10 21:06:33 +0300
commit5edddb1313ed0dc275e6ae70b8a1780ded3a590d (patch)
treefffa478013e8f3622c4e7f85eeb71609cb352322 /src
parenta057817a0983b3a3190f6773101f788f2c6278ba (diff)
downloadmanaplus-5edddb1313ed0dc275e6ae70b8a1780ded3a590d.tar.gz
manaplus-5edddb1313ed0dc275e6ae70b8a1780ded3a590d.tar.bz2
manaplus-5edddb1313ed0dc275e6ae70b8a1780ded3a590d.tar.xz
manaplus-5edddb1313ed0dc275e6ae70b8a1780ded3a590d.zip
Replace xmlStrEqual to xmlNameEqual.
Diffstat (limited to 'src')
-rw-r--r--src/actorsprite.cpp6
-rw-r--r--src/configuration.cpp8
-rw-r--r--src/effectmanager.cpp4
-rw-r--r--src/gui/equipmentwindow.cpp6
-rw-r--r--src/gui/serverdialog.cpp8
-rw-r--r--src/gui/skilldialog.cpp6
-rw-r--r--src/gui/theme.cpp14
-rw-r--r--src/gui/updaterwindow.cpp4
-rw-r--r--src/net/manaserv/attributes.cpp8
-rw-r--r--src/particle.cpp8
-rw-r--r--src/particleemitter.cpp22
-rw-r--r--src/resources/chardb.cpp8
-rw-r--r--src/resources/colordb.cpp10
-rw-r--r--src/resources/emotedb.cpp16
-rw-r--r--src/resources/itemdb.cpp28
-rw-r--r--src/resources/mapdb.cpp2
-rw-r--r--src/resources/mapreader.cpp26
-rw-r--r--src/resources/monsterdb.cpp12
-rw-r--r--src/resources/npcdb.cpp8
-rw-r--r--src/resources/specialdb.cpp6
-rw-r--r--src/resources/spritedef.cpp24
-rw-r--r--src/simpleanimation.cpp6
-rw-r--r--src/statuseffect.cpp8
-rw-r--r--src/units.cpp6
-rw-r--r--src/utils/xml.cpp2
-rw-r--r--src/utils/xml.h2
26 files changed, 131 insertions, 127 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp
index fd2de295a..c1c139bb9 100644
--- a/src/actorsprite.cpp
+++ b/src/actorsprite.cpp
@@ -182,7 +182,7 @@ static EffectDescription *getEffectDescription(int effectId)
XML::Document doc(EFFECTS_FILE);
XmlNodePtr root = doc.rootNode();
- if (!root || !xmlStrEqual(root->name, BAD_CAST "being-effects"))
+ if (!root || !xmlNameEqual(root, "being-effects"))
{
logger->log1("Error loading being effects file: "
EFFECTS_FILE);
@@ -193,13 +193,13 @@ static EffectDescription *getEffectDescription(int effectId)
{
int id;
- if (xmlStrEqual(node->name, BAD_CAST "effect"))
+ if (xmlNameEqual(node, "effect"))
{
EffectDescription *EffectDescription =
getEffectDescription(node, &id);
effects[id] = EffectDescription;
}
- else if (xmlStrEqual(node->name, BAD_CAST "default"))
+ else if (xmlNameEqual(node, "default"))
{
EffectDescription *effectDescription =
getEffectDescription(node, &id);
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 957fa1798..b3d5d77d0 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -432,7 +432,7 @@ void ConfigurationObject::initFromXML(XmlNodePtr parent_node)
for_each_xml_child_node(node, parent_node)
{
- if (xmlStrEqual(node->name, BAD_CAST "list"))
+ if (xmlNameEqual(node, "list"))
{
// list option handling
@@ -440,7 +440,7 @@ void ConfigurationObject::initFromXML(XmlNodePtr parent_node)
for_each_xml_child_node(subnode, node)
{
- if (xmlStrEqual(subnode->name, BAD_CAST name.c_str())
+ if (xmlNameEqual(subnode, name.c_str())
&& subnode->type == XML_ELEMENT_NODE)
{
ConfigurationObject *cobj = new ConfigurationObject;
@@ -452,7 +452,7 @@ void ConfigurationObject::initFromXML(XmlNodePtr parent_node)
}
}
- else if (xmlStrEqual(node->name, BAD_CAST "option"))
+ else if (xmlNameEqual(node, "option"))
{
// single option handling
@@ -491,7 +491,7 @@ void Configuration::init(const std::string &filename, bool useResManager)
XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "configuration"))
+ if (!rootNode || !xmlNameEqual(rootNode, "configuration"))
{
logger->log("Warning: No configuration file (%s)", filename.c_str());
return;
diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp
index b00687631..de12ecaa5 100644
--- a/src/effectmanager.cpp
+++ b/src/effectmanager.cpp
@@ -34,7 +34,7 @@ EffectManager::EffectManager()
XML::Document doc("effects.xml");
XmlNodePtr root = doc.rootNode();
- if (!root || !xmlStrEqual(root->name, BAD_CAST "being-effects"))
+ if (!root || !xmlNameEqual(root, "being-effects"))
{
logger->log1("Error loading being effects file: effects.xml");
return;
@@ -46,7 +46,7 @@ EffectManager::EffectManager()
for_each_xml_child_node(node, root)
{
- if (xmlStrEqual(node->name, BAD_CAST "effect"))
+ if (xmlNameEqual(node, "effect"))
{
EffectDescription ed;
ed.id = XML::getProperty(node, "id", -1);
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 4bfc477a0..0dadca2dc 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -371,11 +371,11 @@ void EquipmentWindow::fillBoxes()
for_each_xml_child_node(node, root)
{
- if (xmlStrEqual(node->name, BAD_CAST "window"))
+ if (xmlNameEqual(node, "window"))
loadWindow(node);
- else if (xmlStrEqual(node->name, BAD_CAST "playerbox"))
+ else if (xmlNameEqual(node, "playerbox"))
loadPlayerBox(node);
- else if (xmlStrEqual(node->name, BAD_CAST "slot"))
+ else if (xmlNameEqual(node, "slot"))
loadSlot(node, mImageSet);
}
delete doc;
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index a4a477527..85b3bbf4e 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -630,7 +630,7 @@ void ServerDialog::loadServers(bool addNew)
XML::Document doc(mDir + "/serverlist.xml", false);
XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "serverlist"))
+ if (!rootNode || !xmlNameEqual(rootNode, "serverlist"))
{
logger->log1("Error loading server list!");
return;
@@ -646,7 +646,7 @@ void ServerDialog::loadServers(bool addNew)
for_each_xml_child_node(serverNode, rootNode)
{
- if (!xmlStrEqual(serverNode->name, BAD_CAST "server"))
+ if (!xmlNameEqual(serverNode, "server"))
continue;
ServerInfo server;
@@ -681,7 +681,7 @@ void ServerDialog::loadServers(bool addNew)
for_each_xml_child_node(subNode, serverNode)
{
- if (xmlStrEqual(subNode->name, BAD_CAST "connection"))
+ if (xmlNameEqual(subNode, "connection"))
{
server.hostname = XML::getProperty(subNode, "hostname", "");
server.port = static_cast<short unsigned>(
@@ -693,7 +693,7 @@ void ServerDialog::loadServers(bool addNew)
server.port = defaultPortForServerType(server.type);
}
}
- else if (xmlStrEqual(subNode->name, BAD_CAST "description"))
+ else if (xmlNameEqual(subNode, "description"))
{
server.description = reinterpret_cast<const char*>(
subNode->xmlChildrenNode->content);
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index 72f5a8ca1..4ee674325 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -370,7 +370,7 @@ void SkillDialog::loadSkills(const std::string &file)
SkillListBox *listbox;
SkillTab *tab;
- if (!root || !xmlStrEqual(root->name, BAD_CAST "skills"))
+ if (!root || !xmlNameEqual(root, "skills"))
{
logger->log("Error loading skills file: %s", file.c_str());
@@ -413,7 +413,7 @@ void SkillDialog::loadSkills(const std::string &file)
for_each_xml_child_node(set, root)
{
- if (xmlStrEqual(set->name, BAD_CAST "set"))
+ if (xmlNameEqual(set, "set"))
{
setCount++;
setName = XML::getProperty(set, "name",
@@ -425,7 +425,7 @@ void SkillDialog::loadSkills(const std::string &file)
for_each_xml_child_node(node, set)
{
- if (xmlStrEqual(node->name, BAD_CAST "skill"))
+ if (xmlNameEqual(node, "skill"))
{
int id = atoi(XML::getProperty(node, "id", "-1").c_str());
std::string name = XML::getProperty(node, "name",
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 2d3b0beea..85fd215ac 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -317,7 +317,7 @@ Skin *Theme::readSkin(const std::string &filename)
XML::Document doc(resolveThemePath(filename));
XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "skinset"))
+ if (!rootNode || !xmlNameEqual(rootNode, "skinset"))
return nullptr;
const std::string skinSetImage = XML::getProperty(rootNode, "image", "");
@@ -339,7 +339,7 @@ Skin *Theme::readSkin(const std::string &filename)
// iterate <widget>'s
for_each_xml_child_node(widgetNode, rootNode)
{
- if (!xmlStrEqual(widgetNode->name, BAD_CAST "widget"))
+ if (!xmlNameEqual(widgetNode, "widget"))
continue;
const std::string widgetType =
@@ -348,7 +348,7 @@ Skin *Theme::readSkin(const std::string &filename)
{
for_each_xml_child_node(partNode, widgetNode)
{
- if (xmlStrEqual(partNode->name, BAD_CAST "part"))
+ if (xmlNameEqual(partNode, "part"))
{
const std::string partType =
XML::getProperty(partNode, "type", "unknown");
@@ -477,7 +477,7 @@ Skin *Theme::readSkin(const std::string &filename)
"'%s'", partType.c_str());
}
}
- else if (xmlStrEqual(partNode->name, BAD_CAST "option"))
+ else if (xmlNameEqual(partNode, "option"))
{
const std::string name = XML::getProperty(
partNode, "name", "");
@@ -820,7 +820,7 @@ void Theme::loadColors(std::string file)
XML::Document doc(resolveThemePath(file));
XmlNodePtr root = doc.rootNode();
- if (!root || !xmlStrEqual(root->name, BAD_CAST "colors"))
+ if (!root || !xmlNameEqual(root, "colors"))
{
logger->log("Error loading colors file: %s", file.c_str());
return;
@@ -835,7 +835,7 @@ void Theme::loadColors(std::string file)
for_each_xml_child_node(node, root)
{
- if (xmlStrEqual(node->name, BAD_CAST "color"))
+ if (xmlNameEqual(node, "color"))
{
type = readColorType(XML::getProperty(node, "id", ""));
if (type < 0) // invalid or no type given
@@ -850,7 +850,7 @@ void Theme::loadColors(std::string file)
mColors[type].set(type, color, grad, 10);
}
- else if (xmlStrEqual(node->name, BAD_CAST "progressbar"))
+ else if (xmlNameEqual(node, "progressbar"))
{
type = readProgressType(XML::getProperty(node, "id", ""));
if (type < 0) // invalid or no type given
diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp
index 5e8e51464..39dde65c3 100644
--- a/src/gui/updaterwindow.cpp
+++ b/src/gui/updaterwindow.cpp
@@ -69,7 +69,7 @@ std::vector<updateFile> loadXMLFile(const std::string &fileName)
XML::Document doc(fileName, false);
XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "updates"))
+ if (!rootNode || !xmlNameEqual(rootNode, "updates"))
{
logger->log("Error loading update file: %s", fileName.c_str());
return files;
@@ -78,7 +78,7 @@ std::vector<updateFile> loadXMLFile(const std::string &fileName)
for_each_xml_child_node(fileNode, rootNode)
{
// Ignore all tags except for the "update" tags
- if (!xmlStrEqual(fileNode->name, BAD_CAST "update"))
+ if (!xmlNameEqual(fileNode, "update"))
continue;
updateFile file;
diff --git a/src/net/manaserv/attributes.cpp b/src/net/manaserv/attributes.cpp
index 01bd23273..662032e29 100644
--- a/src/net/manaserv/attributes.cpp
+++ b/src/net/manaserv/attributes.cpp
@@ -240,7 +240,7 @@ namespace Attributes
XML::Document doc(DEFAULT_ATTRIBUTESDB_FILE);
XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "attributes"))
+ if (!rootNode || !xmlNameEqual(rootNode, "attributes"))
{
logger->log("Attributes: Error while loading "
DEFAULT_ATTRIBUTESDB_FILE ". Using Built-ins.");
@@ -251,7 +251,7 @@ namespace Attributes
for_each_xml_child_node(node, rootNode)
{
- if (xmlStrEqual(node->name, BAD_CAST "attribute"))
+ if (xmlNameEqual(node, "attribute"))
{
int id = XML::getProperty(node, "id", 0);
@@ -290,7 +290,7 @@ namespace Attributes
unsigned int count = 0;
for_each_xml_child_node(effectNode, node)
{
- if (!xmlStrEqual(effectNode->name, BAD_CAST "modifier"))
+ if (!xmlNameEqual(effectNode, "modifier"))
continue;
++count;
std::string tag = XML::getProperty(effectNode, "tag", "");
@@ -334,7 +334,7 @@ namespace Attributes
logger->log("Found %d tags for attribute %d.", count, id);
}// End attribute
- else if (xmlStrEqual(node->name, BAD_CAST "points"))
+ else if (xmlNameEqual(node, "points"))
{
creationPoints = XML::getProperty(
node, "start", DEFAULT_POINTS);
diff --git a/src/particle.cpp b/src/particle.cpp
index aae780b7a..a0acb4f73 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -293,7 +293,7 @@ Particle *Particle::addEffect(const std::string &particleEffectFile,
XML::Document doc(particleEffectFile.substr(0, pos));
XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "effect"))
+ if (!rootNode || !xmlNameEqual(rootNode, "effect"))
{
logger->log("Error loading particle: %s", particleEffectFile.c_str());
return nullptr;
@@ -305,7 +305,7 @@ Particle *Particle::addEffect(const std::string &particleEffectFile,
for_each_xml_child_node(effectChildNode, rootNode)
{
// We're only interested in particles
- if (!xmlStrEqual(effectChildNode->name, BAD_CAST "particle"))
+ if (!xmlNameEqual(effectChildNode, "particle"))
continue;
// Determine the exact particle type
@@ -361,14 +361,14 @@ Particle *Particle::addEffect(const std::string &particleEffectFile,
// Look for additional emitters for this particle
for_each_xml_child_node(emitterNode, effectChildNode)
{
- if (xmlStrEqual(emitterNode->name, BAD_CAST "emitter"))
+ if (xmlNameEqual(emitterNode, "emitter"))
{
ParticleEmitter *newEmitter;
newEmitter = new ParticleEmitter(emitterNode, newParticle,
mMap, rotation, dyePalettes);
newParticle->addEmitter(newEmitter);
}
- else if (xmlStrEqual(emitterNode->name, BAD_CAST "deatheffect"))
+ else if (xmlNameEqual(emitterNode, "deatheffect"))
{
std::string deathEffect = reinterpret_cast<const char*>(
emitterNode->xmlChildrenNode->content);
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index 40f06d671..62f6767c6 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -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);
diff --git a/src/resources/chardb.cpp b/src/resources/chardb.cpp
index 4be2e2b04..f38f13224 100644
--- a/src/resources/chardb.cpp
+++ b/src/resources/chardb.cpp
@@ -46,7 +46,7 @@ void CharDB::load()
XML::Document *doc = new XML::Document("charcreation.xml");
XmlNodePtr root = doc->rootNode();
- if (!root || !xmlStrEqual(root->name, BAD_CAST "chars"))
+ if (!root || !xmlNameEqual(root, "chars"))
{
logger->log1("CharDB: Failed to parse charcreation.xml.");
@@ -56,15 +56,15 @@ void CharDB::load()
for_each_xml_child_node(node, root)
{
- if (xmlStrEqual(node->name, BAD_CAST "haircolor"))
+ if (xmlNameEqual(node, "haircolor"))
{
loadMinMax(node, &mMinHairColor, &mMaxHairColor);
}
- else if (xmlStrEqual(node->name, BAD_CAST "hairstyle"))
+ else if (xmlNameEqual(node, "hairstyle"))
{
loadMinMax(node, &mMinHairStyle, &mMaxHairStyle);
}
- else if (xmlStrEqual(node->name, BAD_CAST "stat"))
+ else if (xmlNameEqual(node, "stat"))
{
loadMinMax(node, &mMinStat, &mMaxStat);
mSumStat = XML::getProperty(node, "sum", 0);
diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp
index cdbfbeba8..1ffe507b2 100644
--- a/src/resources/colordb.cpp
+++ b/src/resources/colordb.cpp
@@ -52,7 +52,7 @@ void ColorDB::loadHair()
XmlNodePtr root = doc->rootNode();
bool hairXml = true;
- if (!root || !xmlStrEqual(root->name, BAD_CAST "colors"))
+ if (!root || !xmlNameEqual(root, "colors"))
{
logger->log1("Trying to fall back on colors.xml");
@@ -62,7 +62,7 @@ void ColorDB::loadHair()
doc = new XML::Document("colors.xml");
root = doc->rootNode();
- if (!root || !xmlStrEqual(root->name, BAD_CAST "colors"))
+ if (!root || !xmlNameEqual(root, "colors"))
{
logger->log1("ColorDB: Failed to find any color files.");
mHairColors[0] = mFail;
@@ -76,7 +76,7 @@ void ColorDB::loadHair()
for_each_xml_child_node(node, root)
{
- if (xmlStrEqual(node->name, BAD_CAST "color"))
+ if (xmlNameEqual(node, "color"))
{
int id = XML::getProperty(node, "id", 0);
@@ -106,7 +106,7 @@ void ColorDB::loadColorLists()
for_each_xml_child_node(node, root)
{
- if (xmlStrEqual(node->name, BAD_CAST "list"))
+ if (xmlNameEqual(node, "list"))
{
std::string name = XML::getProperty(node, "name", "");
if (name.empty())
@@ -120,7 +120,7 @@ void ColorDB::loadColorLists()
for_each_xml_child_node(colorNode, node)
{
- if (xmlStrEqual(colorNode->name, BAD_CAST "color"))
+ if (xmlNameEqual(colorNode, "color"))
{
ItemColor c(XML::getProperty(colorNode, "id", -1),
XML::getProperty(colorNode, "name", ""),
diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp
index 163d8b879..c6126a57b 100644
--- a/src/resources/emotedb.cpp
+++ b/src/resources/emotedb.cpp
@@ -54,7 +54,7 @@ void EmoteDB::load()
XML::Document doc("emotes.xml");
XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "emotes"))
+ if (!rootNode || !xmlNameEqual(rootNode, "emotes"))
{
logger->log1("Emote Database: Error while loading emotes.xml!");
return;
@@ -63,7 +63,7 @@ void EmoteDB::load()
//iterate <emote>s
for_each_xml_child_node(emoteNode, rootNode)
{
- if (!xmlStrEqual(emoteNode->name, BAD_CAST "emote"))
+ if (!xmlNameEqual(emoteNode, "emote"))
continue;
int id = XML::getProperty(emoteNode, "id", -1);
@@ -81,7 +81,7 @@ void EmoteDB::load()
if (!spriteNode->xmlChildrenNode)
continue;
- if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite"))
+ if (xmlNameEqual(spriteNode, "sprite"))
{
EmoteSprite *currentSprite = new EmoteSprite;
std::string file = paths.getStringValue("sprites")
@@ -92,7 +92,7 @@ void EmoteDB::load()
currentSprite->name = XML::getProperty(spriteNode, "name", "");
currentInfo->sprites.push_back(currentSprite);
}
- else if (xmlStrEqual(spriteNode->name, BAD_CAST "particlefx"))
+ else if (xmlNameEqual(spriteNode, "particlefx"))
{
std::string particlefx = reinterpret_cast<const char*>(
spriteNode->xmlChildrenNode->content);
@@ -108,7 +108,7 @@ void EmoteDB::load()
XML::Document doc2("graphics/sprites/manaplus_emotes.xml");
rootNode = doc2.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "emotes"))
+ if (!rootNode || !xmlNameEqual(rootNode, "emotes"))
{
logger->log1("Emote Database: Error while loading"
" manaplus_emotes.xml!");
@@ -118,7 +118,7 @@ void EmoteDB::load()
//iterate <emote>s
for_each_xml_child_node(emoteNode, rootNode)
{
- if (!xmlStrEqual(emoteNode->name, BAD_CAST "emote"))
+ if (!xmlNameEqual(emoteNode, "emote"))
continue;
int id = XML::getProperty(emoteNode, "id", -1);
@@ -136,7 +136,7 @@ void EmoteDB::load()
if (!spriteNode->xmlChildrenNode)
continue;
- if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite"))
+ if (xmlNameEqual(spriteNode, "sprite"))
{
EmoteSprite *currentSprite = new EmoteSprite;
std::string file = paths.getStringValue("sprites")
@@ -147,7 +147,7 @@ void EmoteDB::load()
currentSprite->name = XML::getProperty(spriteNode, "name", "");
currentInfo->sprites.push_back(currentSprite);
}
- else if (xmlStrEqual(spriteNode->name, BAD_CAST "particlefx"))
+ else if (xmlNameEqual(spriteNode, "particlefx"))
{
std::string particlefx = reinterpret_cast<const char*>(
spriteNode->xmlChildrenNode->content);
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index fcc20613d..5fa68a88f 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -174,7 +174,7 @@ void ItemDB::load()
XML::Document doc("items.xml");
XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "items"))
+ if (!rootNode || !xmlNameEqual(rootNode, "items"))
{
logger->log("ItemDB: Error while loading items.xml!");
mLoaded = true;
@@ -183,7 +183,7 @@ void ItemDB::load()
for_each_xml_child_node(node, rootNode)
{
- if (!xmlStrEqual(node->name, BAD_CAST "item"))
+ if (!xmlNameEqual(node, "item"))
continue;
int id = XML::getProperty(node, "id", 0);
@@ -324,7 +324,7 @@ void ItemDB::load()
for_each_xml_child_node(itemChild, node)
{
- if (xmlStrEqual(itemChild->name, BAD_CAST "sprite"))
+ if (xmlNameEqual(itemChild, "sprite"))
{
std::string attackParticle = XML::getProperty(
itemChild, "particle-effect", "");
@@ -332,23 +332,23 @@ void ItemDB::load()
loadSpriteRef(itemInfo, itemChild);
}
- else if (xmlStrEqual(itemChild->name, BAD_CAST "sound"))
+ else if (xmlNameEqual(itemChild, "sound"))
{
loadSoundRef(itemInfo, itemChild);
}
- else if (xmlStrEqual(itemChild->name, BAD_CAST "floor"))
+ else if (xmlNameEqual(itemChild, "floor"))
{
loadFloorSprite(&display, itemChild);
}
- else if (xmlStrEqual(itemChild->name, BAD_CAST "replace"))
+ else if (xmlNameEqual(itemChild, "replace"))
{
loadReplaceSprite(itemInfo, itemChild);
}
- else if (xmlStrEqual(itemChild->name, BAD_CAST "drawAfter"))
+ else if (xmlNameEqual(itemChild, "drawAfter"))
{
loadOrderSprite(itemInfo, itemChild, true);
}
- else if (xmlStrEqual(itemChild->name, BAD_CAST "drawBefore"))
+ else if (xmlNameEqual(itemChild, "drawBefore"))
{
loadOrderSprite(itemInfo, itemChild, false);
}
@@ -630,7 +630,7 @@ void loadFloorSprite(SpriteDisplay *display, XmlNodePtr floorNode)
{
for_each_xml_child_node(spriteNode, floorNode)
{
- if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite"))
+ if (xmlNameEqual(spriteNode, "sprite"))
{
SpriteReference *currentSprite = new SpriteReference;
currentSprite->sprite = reinterpret_cast<const char*>(
@@ -639,7 +639,7 @@ void loadFloorSprite(SpriteDisplay *display, XmlNodePtr floorNode)
= XML::getProperty(spriteNode, "variant", 0);
display->sprites.push_back(currentSprite);
}
- else if (xmlStrEqual(spriteNode->name, BAD_CAST "particlefx"))
+ else if (xmlNameEqual(spriteNode, "particlefx"))
{
std::string particlefx = reinterpret_cast<const char*>(
spriteNode->xmlChildrenNode->content);
@@ -669,7 +669,7 @@ void loadReplaceSprite(ItemInfo *itemInfo, XmlNodePtr replaceNode)
continue;
for_each_xml_child_node(itemNode, replaceNode)
{
- if (xmlStrEqual(itemNode->name, BAD_CAST "item"))
+ if (xmlNameEqual(itemNode, "item"))
{
int from = XML::getProperty(itemNode, "from", 0);
int to = XML::getProperty(itemNode, "to", 1);
@@ -691,7 +691,7 @@ void loadReplaceSprite(ItemInfo *itemInfo, XmlNodePtr replaceNode)
for_each_xml_child_node(itemNode, replaceNode)
{
- if (xmlStrEqual(itemNode->name, BAD_CAST "item"))
+ if (xmlNameEqual(itemNode, "item"))
{
int from = XML::getProperty(itemNode, "from", 0);
int to = XML::getProperty(itemNode, "to", 1);
@@ -724,7 +724,7 @@ void loadReplaceSprite(ItemInfo *itemInfo, XmlNodePtr replaceNode)
for_each_xml_child_node(itemNode, replaceNode)
{
- if (xmlStrEqual(itemNode->name, BAD_CAST "item"))
+ if (xmlNameEqual(itemNode, "item"))
{
int from = XML::getProperty(itemNode, "from", 0);
int to = XML::getProperty(itemNode, "to", 1);
@@ -754,7 +754,7 @@ void loadReplaceSprite(ItemInfo *itemInfo, XmlNodePtr replaceNode)
return;
for_each_xml_child_node(itemNode, replaceNode)
{
- if (xmlStrEqual(itemNode->name, BAD_CAST "item"))
+ if (xmlNameEqual(itemNode, "item"))
{
int from = XML::getProperty(itemNode, "from", 0);
int to = XML::getProperty(itemNode, "to", 1);
diff --git a/src/resources/mapdb.cpp b/src/resources/mapdb.cpp
index aa10aff85..b186ad658 100644
--- a/src/resources/mapdb.cpp
+++ b/src/resources/mapdb.cpp
@@ -52,7 +52,7 @@ void MapDB::load()
for_each_xml_child_node(node, root)
{
- if (xmlStrEqual(node->name, BAD_CAST "map"))
+ if (xmlNameEqual(node, "map"))
{
std::string name = XML::getProperty(node, "name", "");
if (name.empty())
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index aa7bce59d..8d71779f2 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -227,7 +227,7 @@ Map *MapReader::readMap(const std::string &filename,
// Parse the inflated map data
if (node)
{
- if (!xmlStrEqual(node->name, BAD_CAST "map"))
+ if (!xmlNameEqual(node, "map"))
logger->log("Error: Not a map file (%s)!", realFilename.c_str());
else
map = readMap(node, realFilename);
@@ -276,23 +276,23 @@ Map *MapReader::readMap(XmlNodePtr node, const std::string &path)
for_each_xml_child_node(childNode, node)
{
- if (xmlStrEqual(childNode->name, BAD_CAST "tileset"))
+ if (xmlNameEqual(childNode, "tileset"))
{
Tileset *tileset = readTileset(childNode, pathDir, map);
if (tileset)
map->addTileset(tileset);
}
- else if (xmlStrEqual(childNode->name, BAD_CAST "layer"))
+ else if (xmlNameEqual(childNode, "layer"))
{
readLayer(childNode, map);
}
- else if (xmlStrEqual(childNode->name, BAD_CAST "properties"))
+ else if (xmlNameEqual(childNode, "properties"))
{
readProperties(childNode, map);
map->setVersion(atoi(map->getProperty(
"manaplus version").c_str()));
}
- else if (xmlStrEqual(childNode->name, BAD_CAST "objectgroup"))
+ else if (xmlNameEqual(childNode, "objectgroup"))
{
// The object group offset is applied to each object individually
const int tileOffsetX = XML::getProperty(childNode, "x", 0);
@@ -302,7 +302,7 @@ Map *MapReader::readMap(XmlNodePtr node, const std::string &path)
for_each_xml_child_node(objectNode, childNode)
{
- if (xmlStrEqual(objectNode->name, BAD_CAST "object"))
+ if (xmlNameEqual(objectNode, "object"))
{
std::string objType = XML::getProperty(
objectNode, "type", "");
@@ -386,7 +386,7 @@ void MapReader::readProperties(XmlNodePtr node, Properties *props)
for_each_xml_child_node(childNode, node)
{
- if (!xmlStrEqual(childNode->name, BAD_CAST "property"))
+ if (!xmlNameEqual(childNode, "property"))
continue;
// Example: <property name="name" value="value"/>
@@ -472,7 +472,7 @@ void MapReader::readLayer(XmlNodePtr node, Map *map)
// Load the tile data
for_each_xml_child_node(childNode, node)
{
- if (!xmlStrEqual(childNode->name, BAD_CAST "data"))
+ if (!xmlNameEqual(childNode, "data"))
continue;
const std::string encoding =
@@ -619,7 +619,7 @@ void MapReader::readLayer(XmlNodePtr node, Map *map)
// Read plain XML map file
for_each_xml_child_node(childNode2, childNode)
{
- if (!xmlStrEqual(childNode2->name, BAD_CAST "tile"))
+ if (!xmlNameEqual(childNode2, "tile"))
continue;
const int gid = XML::getProperty(childNode2, "gid", -1);
@@ -678,7 +678,7 @@ Tileset *MapReader::readTileset(XmlNodePtr node, const std::string &path,
for_each_xml_child_node(childNode, node)
{
- if (xmlStrEqual(childNode->name, BAD_CAST "image"))
+ if (xmlNameEqual(childNode, "image"))
{
const std::string source = XML::getProperty(
childNode, "source", "");
@@ -703,11 +703,11 @@ Tileset *MapReader::readTileset(XmlNodePtr node, const std::string &path,
}
}
}
- else if (xmlStrEqual(childNode->name, BAD_CAST "tile"))
+ else if (xmlNameEqual(childNode, "tile"))
{
for_each_xml_child_node(tileNode, childNode)
{
- if (!xmlStrEqual(tileNode->name, BAD_CAST "properties"))
+ if (!xmlNameEqual(tileNode, "properties"))
continue;
int tileGID = firstGid + XML::getProperty(childNode, "id", 0);
@@ -716,7 +716,7 @@ Tileset *MapReader::readTileset(XmlNodePtr node, const std::string &path,
std::map<std::string, int> tileProperties;
for_each_xml_child_node(propertyNode, tileNode)
{
- if (!xmlStrEqual(propertyNode->name, BAD_CAST "property"))
+ if (!xmlNameEqual(propertyNode, "property"))
continue;
std::string name = XML::getProperty(
propertyNode, "name", "");
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp
index e6901fa2f..9d295db35 100644
--- a/src/resources/monsterdb.cpp
+++ b/src/resources/monsterdb.cpp
@@ -54,7 +54,7 @@ void MonsterDB::load()
XML::Document doc("monsters.xml");
XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "monsters"))
+ if (!rootNode || !xmlNameEqual(rootNode, "monsters"))
{
logger->log("Monster Database: Error while loading monster.xml!");
mLoaded = true;
@@ -71,7 +71,7 @@ void MonsterDB::load()
//iterate <monster>s
for_each_xml_child_node(monsterNode, rootNode)
{
- if (!xmlStrEqual(monsterNode->name, BAD_CAST "monster"))
+ if (!xmlNameEqual(monsterNode, "monster"))
continue;
BeingInfo *currentInfo = new BeingInfo;
@@ -119,7 +119,7 @@ void MonsterDB::load()
if (!spriteNode->xmlChildrenNode)
continue;
- if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite"))
+ if (xmlNameEqual(spriteNode, "sprite"))
{
SpriteReference *currentSprite = new SpriteReference;
currentSprite->sprite = reinterpret_cast<const char*>(
@@ -129,7 +129,7 @@ void MonsterDB::load()
spriteNode, "variant", 0);
display.sprites.push_back(currentSprite);
}
- else if (xmlStrEqual(spriteNode->name, BAD_CAST "sound"))
+ else if (xmlNameEqual(spriteNode, "sound"))
{
std::string event = XML::getProperty(spriteNode, "event", "");
const char *filename;
@@ -172,7 +172,7 @@ void MonsterDB::load()
currentInfo->getName().c_str());
}
}
- else if (xmlStrEqual(spriteNode->name, BAD_CAST "attack"))
+ else if (xmlNameEqual(spriteNode, "attack"))
{
const int id = XML::getProperty(spriteNode, "id", 0);
const std::string particleEffect = XML::getProperty(
@@ -185,7 +185,7 @@ void MonsterDB::load()
currentInfo->addAttack(id, spriteAction,
particleEffect, missileParticle);
}
- else if (xmlStrEqual(spriteNode->name, BAD_CAST "particlefx"))
+ else if (xmlNameEqual(spriteNode, "particlefx"))
{
display.particles.push_back(reinterpret_cast<const char*>(
spriteNode->xmlChildrenNode->content));
diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp
index b823620f0..832fa26d6 100644
--- a/src/resources/npcdb.cpp
+++ b/src/resources/npcdb.cpp
@@ -48,7 +48,7 @@ void NPCDB::load()
XML::Document doc("npcs.xml");
XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "npcs"))
+ if (!rootNode || !xmlNameEqual(rootNode, "npcs"))
{
logger->log("NPC Database: Error while loading npcs.xml!");
mLoaded = true;
@@ -58,7 +58,7 @@ void NPCDB::load()
//iterate <npc>s
for_each_xml_child_node(npcNode, rootNode)
{
- if (!xmlStrEqual(npcNode->name, BAD_CAST "npc"))
+ if (!xmlNameEqual(npcNode, "npc"))
continue;
int id = XML::getProperty(npcNode, "id", 0);
@@ -84,7 +84,7 @@ void NPCDB::load()
if (!spriteNode->xmlChildrenNode)
continue;
- if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite"))
+ if (xmlNameEqual(spriteNode, "sprite"))
{
SpriteReference *currentSprite = new SpriteReference;
currentSprite->sprite = reinterpret_cast<const char*>(
@@ -93,7 +93,7 @@ void NPCDB::load()
XML::getProperty(spriteNode, "variant", 0);
display.sprites.push_back(currentSprite);
}
- else if (xmlStrEqual(spriteNode->name, BAD_CAST "particlefx"))
+ else if (xmlNameEqual(spriteNode, "particlefx"))
{
std::string particlefx = reinterpret_cast<const char*>(
spriteNode->xmlChildrenNode->content);
diff --git a/src/resources/specialdb.cpp b/src/resources/specialdb.cpp
index eb4a81c9a..b1a3a9c4d 100644
--- a/src/resources/specialdb.cpp
+++ b/src/resources/specialdb.cpp
@@ -57,7 +57,7 @@ void SpecialDB::load()
XML::Document doc("specials.xml");
XmlNodePtr root = doc.rootNode();
- if (!root || !xmlStrEqual(root->name, BAD_CAST "specials"))
+ if (!root || !xmlNameEqual(root, "specials"))
{
logger->log("Error loading specials file specials.xml");
return;
@@ -67,13 +67,13 @@ void SpecialDB::load()
for_each_xml_child_node(set, root)
{
- if (xmlStrEqual(set->name, BAD_CAST "set"))
+ if (xmlNameEqual(set, "set"))
{
setName = XML::getProperty(set, "name", "Actions");
for_each_xml_child_node(special, set)
{
- if (xmlStrEqual(special->name, BAD_CAST "special"))
+ if (xmlNameEqual(special, "special"))
{
SpecialInfo *info = new SpecialInfo();
int id = XML::getProperty(special, "id", 0);
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index 7ff74ac18..0d9b95f6f 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -83,7 +83,7 @@ SpriteDef *SpriteDef::load(const std::string &animationFile, int variant)
XML::Document doc(animationFile.substr(0, pos));
XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "sprite"))
+ if (!rootNode || !xmlNameEqual(rootNode, "sprite"))
{
logger->log("Error, failed to parse %s", animationFile.c_str());
@@ -149,11 +149,11 @@ void SpriteDef::loadSprite(XmlNodePtr spriteNode, int variant,
for_each_xml_child_node(node, spriteNode)
{
- if (xmlStrEqual(node->name, BAD_CAST "imageset"))
+ if (xmlNameEqual(node, "imageset"))
loadImageSet(node, palettes);
- else if (xmlStrEqual(node->name, BAD_CAST "action"))
+ else if (xmlNameEqual(node, "action"))
loadAction(node, variant_offset);
- else if (xmlStrEqual(node->name, BAD_CAST "include"))
+ else if (xmlNameEqual(node, "include"))
includeSprite(node);
}
}
@@ -223,7 +223,7 @@ void SpriteDef::loadAction(XmlNodePtr node, int variant_offset)
// Load animations
for_each_xml_child_node(animationNode, node)
{
- if (xmlStrEqual(animationNode->name, BAD_CAST "animation"))
+ if (xmlNameEqual(animationNode, "animation"))
loadAnimation(animationNode, action, imageSet, variant_offset);
}
}
@@ -262,7 +262,7 @@ void SpriteDef::loadAnimation(XmlNodePtr animationNode,
offsetY -= imageSet->getHeight() - 32;
offsetX -= imageSet->getWidth() / 2 - 16;
- if (xmlStrEqual(frameNode->name, BAD_CAST "frame"))
+ if (xmlNameEqual(frameNode, "frame"))
{
const int index = XML::getProperty(frameNode, "index", -1);
@@ -282,7 +282,7 @@ void SpriteDef::loadAnimation(XmlNodePtr animationNode,
animation->addFrame(img, delay, offsetX, offsetY, rand);
}
- else if (xmlStrEqual(frameNode->name, BAD_CAST "sequence"))
+ else if (xmlNameEqual(frameNode, "sequence"))
{
const int start = XML::getProperty(frameNode, "start", -1);
const int end = XML::getProperty(frameNode, "end", -1);
@@ -322,22 +322,22 @@ void SpriteDef::loadAnimation(XmlNodePtr animationNode,
repeat --;
}
}
- else if (xmlStrEqual(frameNode->name, BAD_CAST "end"))
+ else if (xmlNameEqual(frameNode, "end"))
{
animation->addTerminator(rand);
}
- else if (xmlStrEqual(frameNode->name, BAD_CAST "jump"))
+ else if (xmlNameEqual(frameNode, "jump"))
{
animation->addJump(XML::getProperty(
frameNode, "action", ""), rand);
}
- else if (xmlStrEqual(frameNode->name, BAD_CAST "label"))
+ else if (xmlNameEqual(frameNode, "label"))
{
std::string name = XML::getProperty(frameNode, "name", "");
if (!name.empty())
animation->addLabel(name);
}
- else if (xmlStrEqual(frameNode->name, BAD_CAST "goto"))
+ else if (xmlNameEqual(frameNode, "goto"))
{
std::string name = XML::getProperty(frameNode, "label", "");
if (!name.empty())
@@ -365,7 +365,7 @@ void SpriteDef::includeSprite(XmlNodePtr includeNode)
XML::Document doc(filename);
XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "sprite"))
+ if (!rootNode || !xmlNameEqual(rootNode, "sprite"))
{
logger->log("Error, no sprite root node in %s", filename.c_str());
return;
diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp
index f0002b47e..2b7cc328d 100644
--- a/src/simpleanimation.cpp
+++ b/src/simpleanimation.cpp
@@ -171,7 +171,7 @@ void SimpleAnimation::initializeAnimation(XmlNodePtr animationNode,
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);
@@ -192,7 +192,7 @@ void SimpleAnimation::initializeAnimation(XmlNodePtr animationNode,
if (mAnimation)
mAnimation->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);
@@ -218,7 +218,7 @@ void SimpleAnimation::initializeAnimation(XmlNodePtr animationNode,
start++;
}
}
- else if (xmlStrEqual(frameNode->name, BAD_CAST "end"))
+ else if (xmlNameEqual(frameNode, "end"))
{
if (mAnimation)
mAnimation->addTerminator(rand);
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp
index 3de30e3cf..a7e06a2f4 100644
--- a/src/statuseffect.cpp
+++ b/src/statuseffect.cpp
@@ -132,7 +132,7 @@ void StatusEffect::load()
XML::Document doc(STATUS_EFFECTS_FILE);
XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "status-effects"))
+ if (!rootNode || !xmlNameEqual(rootNode, "status-effects"))
{
logger->log1("Error loading status effects file: "
STATUS_EFFECTS_FILE);
@@ -145,7 +145,7 @@ void StatusEffect::load()
int index = atoi(XML::getProperty(node, "id", "-1").c_str());
- if (xmlStrEqual(node->name, BAD_CAST "status-effect"))
+ if (xmlNameEqual(node, "status-effect"))
{
the_map = &statusEffects;
int block_index = atoi(XML::getProperty(
@@ -155,8 +155,10 @@ void StatusEffect::load()
blockEffectIndexMap[block_index] = index;
}
- else if (xmlStrEqual(node->name, BAD_CAST "stun-effect"))
+ else if (xmlNameEqual(node, "stun-effect"))
+ {
the_map = &stunEffects;
+ }
if (the_map)
{
diff --git a/src/units.cpp b/src/units.cpp
index c031558cf..804512dbd 100644
--- a/src/units.cpp
+++ b/src/units.cpp
@@ -102,7 +102,7 @@ void Units::loadUnits()
XML::Document doc("units.xml");
XmlNodePtr root = doc.rootNode();
- if (!root || !xmlStrEqual(root->name, BAD_CAST "units"))
+ if (!root || !xmlNameEqual(root, "units"))
{
logger->log1("Error loading unit definition file: units.xml");
return;
@@ -110,7 +110,7 @@ void Units::loadUnits()
for_each_xml_child_node(node, root)
{
- if (xmlStrEqual(node->name, BAD_CAST "unit"))
+ if (xmlNameEqual(node, "unit"))
{
struct UnitDescription ud;
int level = 1;
@@ -127,7 +127,7 @@ void Units::loadUnits()
for_each_xml_child_node(uLevel, node)
{
- if (xmlStrEqual(uLevel->name, BAD_CAST "level"))
+ if (xmlNameEqual(uLevel, "level"))
{
struct UnitLevel ul;
ul.symbol = XML::getProperty(uLevel, "symbol",
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp
index 9d6858d9d..420915d8f 100644
--- a/src/utils/xml.cpp
+++ b/src/utils/xml.cpp
@@ -163,7 +163,7 @@ namespace XML
{
for_each_xml_child_node(child, parent)
{
- if (xmlStrEqual(child->name, BAD_CAST name))
+ if (xmlNameEqual(child, name))
return child;
}
diff --git a/src/utils/xml.h b/src/utils/xml.h
index fac90c63d..821ee2de4 100644
--- a/src/utils/xml.h
+++ b/src/utils/xml.h
@@ -31,6 +31,8 @@
#define XmlNodePtr xmlNodePtr
+#define xmlNameEqual(node, str) xmlStrEqual((node)->name, BAD_CAST (str))
+
/**
* XML helper functions.
*/