check for existence of entity

Blitz3D Forums/Blitz3D Programming/check for existence of entity

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

"There's the sticky part: there's no way for me to know what other type instances are storing a handle to a given entity when I delete that entity."

Well, there's one thing you can do, but I hesitate to mention it because I consider it shoddy programming and when you go back to look at the code later you're sure to forget that this is happening, leading to confusion.

But here goes.

Let's say you have a type, A. And you have a type B.

If type B contains a pointer to an instance of type A, then if you delete type A, the pointer in type B to type A will automatically be set to null.

In other words, if you make a type Ant, and for each ant go ThisAnt.Ant = New Ant, and then you make another type which contains pointers to specific ants, when you Delete ThisAnt, then any pointer in any other type that points to ThisAnt will be set to null.

Not exactly what you were asking for, but it might be of help.


"Basically, there should only ever be one other object storing the entity's handle (since the insect's mate one at a time) but apparently that isn't happening and that's resulting in the intermittent error."

Well then that's a bug that you need to fix, not find a workaround for.