Original Post
Hi guys. I'm working on a little rogue-like game, and have run into a wierd error. This compiles fine, but when save_map() is called, an error is found and the application exits with an error message. Running through the program with a debugger, this error message is displayed: Unhandled exception at 0x010f1ad0 in Supa Basic.exe: 0xC0000005: Access violation reading location 0x010f8000. The 0x010f80000 location is my map[20][40] array, but I'm not sure how to fix this error.
void save_map() {
message("Saving...");
int x=0;
int y=0;
do {
do {
switch (map[y][x])
{
message("4");
//floor
case 0:
save<<".";
break;
//wall
case 1:
save<<"#";
break;
//down stairs
case 2:
save<<">";
break;
//goblin
case 3:
save<<"g";
}
x++;
} while (x!=40);
save<<"\n";
y++;
} while (y!=20);
message("Game Saved!");
}
int map[20][40]= {
0,1,0,0,3,0,0,0,0,0,0,0,
...
};