Sign in to follow this  

disposing item in linked list, but not immediately

Recommended Posts

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.

Share this post

Link to post
Share on other sites
Original post by KulSeran
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
Ditto. Take them out of your main list and put them on death row[grin]

[Edited by - iMalc on October 5, 2005 8:38:58 PM]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this