summaryrefslogtreecommitdiff
path: root/src/resources/spritedef.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-06-26 01:37:48 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-09-27 18:38:28 +0200
commit51f0c23ac190c83bebeace8a49cd2ecd1143fa8c (patch)
treee45ceab35b6cc419f80be6c86753b6ccd1cd22f0 /src/resources/spritedef.cpp
parent632da15234851f3decdbb29cbeb15e1950e41a0d (diff)
downloadmana-51f0c23ac190c83bebeace8a49cd2ecd1143fa8c.tar.gz
mana-51f0c23ac190c83bebeace8a49cd2ecd1143fa8c.tar.bz2
mana-51f0c23ac190c83bebeace8a49cd2ecd1143fa8c.tar.xz
mana-51f0c23ac190c83bebeace8a49cd2ecd1143fa8c.zip
Replaced for_each_xml_child_node macro with helper class
The new XML::Children class enables using a C++11 range-based for loop to iterate over the children of an xmlNodePtr.
Diffstat (limited to 'src/resources/spritedef.cpp')
-rw-r--r--src/resources/spritedef.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index ec41aec0..54f28fe9 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -123,7 +123,7 @@ void SpriteDef::loadSprite(xmlNodePtr spriteNode, int variant,
variant * XML::getProperty(spriteNode, "variant_offset", 0);
}
- for_each_xml_child_node(node, spriteNode)
+ for (auto node : XML::Children(spriteNode))
{
if (xmlStrEqual(node->name, BAD_CAST "imageset"))
{
@@ -198,7 +198,7 @@ void SpriteDef::loadAction(xmlNodePtr node, int variant_offset)
}
// Load animations
- for_each_xml_child_node(animationNode, node)
+ for (auto animationNode : XML::Children(node))
{
if (xmlStrEqual(animationNode->name, BAD_CAST "animation"))
{
@@ -226,7 +226,7 @@ void SpriteDef::loadAnimation(xmlNodePtr animationNode,
action->setAnimation(directionType, animation);
// Get animation frames
- for_each_xml_child_node(frameNode, animationNode)
+ for (auto frameNode : XML::Children(animationNode))
{
const int delay = XML::getProperty(frameNode, "delay",
DEFAULT_FRAME_DELAY);