Tlist.remove() does not remove

BlitzMax Forums/BlitzMax Beginners Area/Tlist.remove() does not remove

I read a tip somewhere to always add things at the front of the list. That would explain why the entity to be removed is at the bottom.

When the game starts it adds three things to the list:
1) A tree (The one that I have problem removing)
2) A house
3) A woodcutter
In that order.

Since I add things at the front, the tree will end up at the bottom.

Now, in my little game, the woodcutter, powered by one of those fancy AI Goal-Driven-AGent-Behaviour thingys, walks up to the tree and starts to swing the axe on it. At the 5th strike, the tree gets a message that it should remove itself. It calls the Remove() method it inherited fron the base Entity type.
But it refuses to work. :P

Now, while writing this, I got an idea. What happens if I try to remove all entities upon exit? I wasn't doing that until now.
Here is the output:
Before remove: List contains 3 entities
 - List claims to not contain the entity...
 -- Requesting a remove: 00CF1E00
 -- In list:
 --- 00CF1E00 <-
 --- 00CEBCD0
 --- 00CF15E0
After remove: List contains 3 entities
Before remove: List contains 3 entities
 - List claims to not contain the entity...
 -- Requesting a remove: 00CEBCD0
 -- In list:
 --- 00CF1E00
 --- 00CEBCD0 <-
 --- 00CF15E0
After remove: List contains 3 entities
Before remove: List contains 3 entities
 - List claims to not contain the entity...
 -- Requesting a remove: 00CF15E0
 -- In list:
 --- 00CF1E00
 --- 00CEBCD0
 --- 00CF15E0 <-
After remove: List contains 3 entities

Nothing is removed. :P

Here is the code I'm calling when the game quits:
For Local e:Entity = EachIn Entity.ent_list
	e.Remove()
Next


So, even outside the main loop, things is acting strange.

I'm not sorting the list, or inverting it. It just contains the entities used in the game. All i do with it is to go through it and drawing/updating when needed.