After initialy prototyping a vector used to hold a list of pointers to game objects I decided a list would be better in that it would allow me too remove any elements from the list. I use the list to genericaly execute a drawing function for all the game objects. The gameobjects currently consist of ships(currently only one but later as many players) and astroids.
Because I need to translate the astroids during the idle times I thought it may be simple to create another list of astroids that refrences the same astroid objects as the master gameobject list but was wondering if there is a better solution.
Should a astroid be destroyed I will need to do three things, remove the pointer from the master gameobjects list and remove the pointer from the astroids list and delete the object.
gameObject. remove(*destroyed);
astroids.remove(*destroyed);
delete destroyed;
I am assuming I already used some iterator and collision function to get a pointer to the gameobject destroyed.
Just analyzing what do you think?