Good Evening,
I have a question that's been a constant source of frustration and I need to learn to deal with it.
Say I have a warrior with a memory (AI) module that polls with world through it's vision and it 'remember's' through a pointer (pointing to a troll) that a troll was detected 2000ms ago.
Now, say I have a wizard that collided with the same troll, and the wizard now has a pointer to the troll 'remembering' the last thing it collided with.
Somewhere down the road, there's a delete call on the troll object.
Now I have the memory module and the wizard with pointers to a deleted object. Let's multiply this over hundreds or thousands of objects and it becomes insanely complex with a multitude of objects and various pointers pointing to objects that may or may not be deleted.
So my questions is this.
Is there a design pattern (hopefully not too obtrusive), algorithm, or a way upon object destruction to notify every other object that's pointing to the destroyed object that it's been deleted so i can NULL the pointers?
Thanks in advance for your time and answers.
Mike