Foreach and for loops
#6

I had some weird thing happen like this when i accessed an array out of bounds at runtime. Random things would just stop working. I also noticed it because it stopped all my timers from working.

I had a variable that counts vehicles as they are created, and i used that variable as an index to an array. I forgot to reset the var when the vehicles were destroyed, which led to indexing an array OOB at runtime. Can be a pain in the ass to find this kind of bug because when you think it's a bug in your code you seldom look at array sizes.

I'm not saying this IS your problem, just saying it may be.
Reply


Messages In This Thread
Foreach and for loops - by CONTROLA - 29.05.2012, 07:42
Re: Foreach and for loops - by MP2 - 29.05.2012, 09:07
Re: Foreach and for loops - by CONTROLA - 29.05.2012, 09:35
Re: Foreach and for loops - by CONTROLA - 29.05.2012, 09:42
Re: Foreach and for loops - by CONTROLA - 29.05.2012, 09:55
Re: Foreach and for loops - by iggy1 - 29.05.2012, 09:56
Re: Foreach and for loops - by CONTROLA - 29.05.2012, 09:59
Re: Foreach and for loops - by iggy1 - 29.05.2012, 10:03

Forum Jump:


Users browsing this thread: 1 Guest(s)