fscanf(input_file, "%d", &map_height); //line 29
The problem is that I don't know whats wrong with it.
If I comment it out the program runs but if I put it back in it stops working?
what do I do now?
fscanf(input_file, "%d", &map_height); //line 29
terrain1.resize(map_height*map_width);
terrain1.resize(map_height*map_width+3);
Hey well i fixed my problem.
It was just an issue which I was modifying memory I was not supposed to. I had to change the following:
terrain1.resize(map_height*map_width);
to
terrain1.resize(map_height*map_width+3);
Well you see the +3 was because +1 did not work.
int i;
for(int y=0;y<map_height;y++){
for(int x=0;x<map_width;x++){
i++;
terrain1.x = x;
terrain1.y = y;
fscanf(input_file, "%d", &terrain1.type);
}
}