Esempio n. 1
0
void Spellbook::xml_read (xml_document<> * doc, xml_node<> * node )
{
  for (xml_attribute<> *attr=node->first_attribute();attr;attr=attr->next_attribute())
  {
    if (!strcmp(attr->name(),"name")){name = string(attr->value());}
  }
  for (xml_node<> *snode=node->first_node();snode;snode=snode->next_sibling())
  {
    Spell newspell;
    newspell.xml_read(&*doc,&*snode);
    spells.push_back(newspell);
  }
}
Esempio n. 2
0
void SpellDatabase::loadSpells(char * filename)
{
  file<> xmlfile(filename);
  xml_document<> doc;
  doc.parse<0>(xmlfile.data());
  Spell spell;
  for (xml_node<> *node = doc.first_node();node;node=node->next_sibling())
  {
    spell = Spell();
    spell.xml_read(&doc,&*node);
    spells.push_back(spell);
  }
}