Now, I have to say I am screwed here. I am writing a map loading feature for my game. It's still in console application stage.
The bug appears to be in the waypoint part. The idea is - every monster has 5 positions to walk. Just to look he's busy ;) . First monster_number is loaded, then the loop ( constantly 5 times) loads coordinates for each waypoint into monster_waypoint;
in
is an ifstream object.
p
is just an integer variable used as file position.
for (N=0;N<5;N++){
for (n=0;n<monster_number;n++){
p+=10;
in.seekg(p);
in >> monster_waypoint[N][n].x;
p+=10;
in.seekg(p);
in >> monster_waypoint[N][n].y;
}
}
Now, I tried to load my example map - everything looks to be loaded fine.
This is fallowed by active object loading, witch is not important in the case.
p+=10;
in.seekg(p); in >> active_obj_number;
But if I want to check the second monsters fifth waypoints x value (phew) with
cout << monster_waypoint[4][1].x;
Program does not crash but rather ignores code that goes after it.
Press any key to continue...
The strange part is that if I put
cout << monster_waypoint[4][0].x;
BEFORE reading active_obj_number it works perfect. It prints correct value. Also if I ask to print something like
cout << monster_waypoint[3][1].x;
it works fine. I assure there is nothing wrong with the binary file itself.