disposing item in linked list, but not immediately
I've a bunch of 'enemies' in a linked list, and when they are shot they must be disposed of. So I search in the list and adjust the list accordingly. But now a problem arises, I need to let the enemy 'live' for a while, but I want to dispose the enemy somewhat later, without searching the list again. How can I solve this problem. Do i need to set a pointer to that pointer in the list? And dispose this pointer later. yuk, getting complicated.
have a second list.
remove "dead" creatures from the first list, insert them into the second list.
then you can delete them from the second list when youare done with them
remove "dead" creatures from the first list, insert them into the second list.
then you can delete them from the second list when youare done with them
Quote:Original post by KulSeranDitto. Take them out of your main list and put them on death row[grin]
have a second list.
remove "dead" creatures from the first list, insert them into the second list.
then you can delete them from the second list when youare done with them
[Edited by - iMalc on October 5, 2005 8:38:58 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement