Here is the code:
Code: Select all
while (xml && xml->read())
{
switch (xml->getNodeType())
{
case EXN_ELEMENT:
/* .... commented out .... */
} // end of case
case EXN_ELEMENT_END:
{
// </target>
if (InTarget && stringw("target") == xml->getNodeName())
{
InTarget = false;
spell->addTargetOption(targetOption);
}
else
// </spell>
if (!InTarget && InSpell && stringw("spell") == xml->getNodeName())
{
InSpell = false;
AllSpells.push_back(spell);
}
else
if (InSpells && !InSpell && stringw("spells") == xml->getNodeName())
{
InSpells = false;
}
break;
}
} // end of switch
} // end of while
Btw, all three if statements evaluates to false at that point, so my code can hardly interfere there.
The xml file looks like this:
Code: Select all
<?xml version="1.0"?>
<spells>
<!-- Harm -->
<spell name="Harm" mana="16">
<target type="target" allowed="all">
<effect type="damage" amount="20" />
</target>
</spell>
</spells>