Hi i use rapidxml to load map in my game this is how my class for loading looks like it's normally compiling but when loading file sometimes it crashing so i wanted to debug it but debugger dont like my function which is setting pointers to data in xml file.
#0 0042D5A6 rapidxml::xml_node<char>::first_node(this=0x0, name=0x484175 <_ZSt16__convert_from_vRKPiPciPKcz+4735349> "MapInfo", name_size=7, case_sensitive=true) (C:/.../rapidxml.hpp:942)
#1 00404E31 MapLoader::SetNodes(this=0x27fc1c) (C:\...\main.cpp:651)
#2 004032F6 main() (C:\...\main.cpp:267)
class MapLoader
{
public:
xml_document<> doc;
file<>xmlFile(char);
string ca,cb,cc,cd;
xml_node<> *test;
xml_node<> *root;
xml_node<> *mapinfo;
xml_node<> *name;
xml_node<> *date;
xml_node<> *msize;
xml_attribute<> *sizex;
xml_attribute<> *sizey;
xml_node<> *mapdata;
xml_node<> *layer;
xml_attribute<> *nr;
xml_node<> *tile;
xml_attribute<> *id;
xml_attribute<> *x;
xml_attribute<> *y;
void LoadFile(const char *filename);
void SetNodes();
void FillVector();
void SaveVector();
};
void MapLoader::SetNodes()
{
root=doc.first_node("root");
mapinfo=root->first_node("MapInfo"); //////debugger is pointing on this line
name=mapinfo->first_node("Name");
date=mapinfo->first_node("Date");
msize=mapinfo->first_node("Size");
sizex=msize->first_attribute("x");
sizey=msize->first_attribute("y");
mapdata=root->first_node("MapData");
layer=mapdata->first_node("Layer");
nr=layer->first_attribute("id");
tile=layer->first_node("Tile");
id=tile->first_attribute("id");
x=tile->first_attribute("x");
y=tile->first_attribute("y");
}
what i can do to repair it or something like that?
Edit: here is my xml file:
<?xml version="1.0" encoding="utf-8"?>
<root>
<MapInfo>
<Name>Test</Name>
<Date>17.08.2014</Date>
<Size x="64" y="64"/>
</MapInfo>
<MapData>
<Layer nr="1">
<Tile id="1" x="32" y="32"/>
<Tile id="1" x="32" y="64"/>
<Tile id="1" x="512" y="64"/>
</Layer>
<Layer nr="2"/>
<Layer nr="3"/>
</MapData>
</root>