Thanks guys for the quick reply.
Well i do check,to make sure i am not deleting twice.
int DeadAlive = Dragon->TestIfDead();
MonPtr = Tail;
if(DeadAlive == true)
{
if(Tail == Dragon){
MonPtr = Dragon;
Dragon = Dragon->Node;
free(MonPtr);
delete MonPtr;
}
else if(Dragon->Node == NULL){
MonPtr = Dragon;
Dragon = Tail;
free(MonPtr);
delete MonPtr;
}
else{
for(short NDC = 0; NDC < DC; NDC++){
MonPtr = MonPtr->Node;
if(NDC + 1 == DC){
Dragon = MonPtr;
Dragon->Node = Dragon->Node->Node;
}
}
free(MonPtr);
delete MonPtr;
}
}
Here is a part of the code. THe one that is crashing...
Dragon is an object. Well,actualy its a linked list. Tail is obviously the pointer to the first Object of the linked list and MonPtr is just a ptr that is used to delete dead dragons.
So as you see i check if the monster is dead,if it is i try to delete it.
So as much as i can tell i am not deleting twice. Is there something i am missing?