RickieES / GCPractica1

0 stars 0 forks source link

Game raises an exception when deleting enemies in vector #9

Closed alejleal closed 1 year ago

alejleal commented 1 year ago

First observed in commit 1dac427 although the problematic line was added in commit ad1608c

...
enemyList.erase(enemyList.begin() + i);
...

If i had to guess, it would probably be caused by deleting elements of the vector using indexes. When removing a specific element, the rest of the elements are shifted and the position changes. I still need to attach the error i get but it would be appreciated if you could check if you can reproduce it (or at least find it).

alejleal commented 1 year ago

Can't reproduce again for some reason