Hello guys. I'm doing this king of programming thingy, which generates an error I cannot understand. Here are the details:
GameCore::~GameCore() // ~Destructor :]
{
delete engine;
for(int j=Map_Size_X - 1;j>=0;j--)
for(int i=Map_Size_Y - 1;i>=0;i--)
{
delete Map[j];
if(j<Visible_Map_Size_X && i<Visible_Map_Size_Y)
delete VisibleMap[j];
}
SDL_Quit();
}
The thing is when I'm running on debug mode (not release mode) on my Visual C++ 6, I'm getting a debug error telling there's some overloading on the heap, or something like that. If I try to take out that whole deletion loop (leaving the function with only deleting the engine variable and running SDL_Quit() ), I'm getting another error telling me that there is a DAMAGE (Yes, with capital letters) and a memory block adress, or something like that. O_o
VisibleMap is 40x30 in size and Map is 100x100.
Here are the details of the type of Map and VisibleMap:
class MapTile // This is the info class for every tile on the map.
{
public:
int x,y; // Place in the map array.
KrTile *Tile; // This is the image of the tile.
U32 Terrain; // This is the U32 code name of the tile, for easier identification.
MapTile()
{
x=0;
y=0;
Tile=NULL;
Terrain = 0;
}
~MapTile()
{
Tile=NULL; /* I tried to put 'delete Tile' instead of the
current line, but that just gave me another
runtime error, probably due to the reason I'm
using SDL and the Kyra sprite engine (based on
SDL). But that's just cause I think I'm not
supposed to delete the Tile images manually,
they are already inside some tree which holds
their adresses and handles them alone without
my intervention. So this current line is
supposed to be just fine.*/
}
};
KrTile, as written above, is a variable that holds an image. The map tile image for this case.
Please help, I'm clueless about this one. I'm not experienced enough to know how the main memory heap works, so I can't understand what the hell is causing the trouble. Thanks a lot for yours, anyway.
Twiggy :)
[Edited by - Twiggy on May 22, 2005 5:55:43 AM]
___________________________"Peg, is there a certain reason that cactus is standing in the place where my alarm clock should be?"