Im trying to make a target launcer fire a target every 5 seconds. The problem is that the clock starts acting funny after the first target is launched. Here is the log from the console:
amountofT is the amount of targets that are currently in the game. degree and force are cout'ed right before the target is fired. My question is why do i get that "clock:2.54222e-005"? This problem is also causing targets to be fired prematurely and then i get some kind "list iterator not incrementable" Debug Assertion Failed message.
Ahh okay the problem seems to be with removing the target once it has crashed. When the target collides i want it to be removed, but instead i get a "list iterator not incrementable" Debug Assertion Failed message. Here is the relevant code:
CollideWithMap sets 'broken' to true if it collides with the map. Remove is returned. Then i get "Debug Assertion Failed!...list iterator not incrementable" because the for loop continues for some reason.
Let's say there are 5 elements in the list, and they contain letters a to e, like this: a,b,c,d,e.
You're at the 4th element; that is, list[i] where i=3. You decide to delete it. Now, the list looks like this:
a,b,c,e
You're still at list[3], which is now the element with the e in it.
Now you increment the iterator. Oh no! You've just incremented the iterator to position 4 in the list, but that doesn't exist! You've incremented an iterator when you shouldn't, because you're not allowed to increment an iterator beyond the end of the list, and it crashes.