This is the XML code:
<?xml version="1.0" encoding="utf-8"?>
<Enemies>
<Enemy id="001" name="Bandit" combatstyle="1" aitype="1" difficulty="1" imgsheet="001.png" level="2" hp"5" />
<Enemy id="005" name="Dragon" combatstyle="1" aitype="1" difficulty="1" imgsheet="002.png" level="5" hp"50" />
</Enemies>
And this it the code i use to search the content:
pugi::xml_document doc;
pugi::xml_parse_result result = doc.load_file("assets/enemies.xml");
pugi::xml_node nodes = doc.child("Enemies");
for (pugi::xml_node tool = nodes.child("Enemy"); tool; tool = tool.next_sibling("Enemy"))
{
//only here to check if it's working
string lol = tool.attribute("name").as_string();
int hi = tool.attribute("id").as_int();
}
When the loop executes tool = tool.next_sibling("Enemy") it reaches the end and jumps out of the loop. I can get the information just fine from the first enemy, so i'm doing something right.
I don't know what i did. But now it seems to work. This is really weird, i didn't change a thing to the class and now it works.
Anyways, all is good!