Hi, I have a very peculiar bug that emerges from a seemingly simple line of code and I don't understand how it happens, here is a simplified version of the code
It's part of a much larger framework (4000+ lines) for 2D/3D games, but the algorythm in question is very simple (the "source" type only contains 3 objects at most)
Every time I run this code section, the computer hangs, screen display becomes corrupted(little red dots in a grid appear on screen) and I have to go and reinstall the 3D card drivers or Windows won't even boot!
Anybody has an idea what's going on and what can cause this bug and the hardware corruption?
I know it could be a problem with my 3D card (geforce 6600) but the point is that, this particular line of code, and only this one, will always trigger the problem.
And I don't see anything there that should trigger a problem. As I said it's not a very intensie part of the program (there are much more intensive and complex algorythms in other places of the program) and the list of "source" objects is comprised of 3 objects at most.
type source field toX#, toY# end type ;Main loop repeat ;....<i>lots of other stuff goes here....</i> for s.source=each source special(s) next renderworld flip until endgame ;end main loop here function special(s.source) repeat a=0 s\toX=rnd(1,3) : s\toY=rnd(1,3) for s2.source=each source ;THE FOLLOWING LINE IS CAUSING THE BUG, IF I COMMENT IT OUT NO MORE BUG! if s2<>s and s2\toX=s\toX and s2\toY=s\toY then a=1 next until a=0 end function
It's part of a much larger framework (4000+ lines) for 2D/3D games, but the algorythm in question is very simple (the "source" type only contains 3 objects at most)
Every time I run this code section, the computer hangs, screen display becomes corrupted(little red dots in a grid appear on screen) and I have to go and reinstall the 3D card drivers or Windows won't even boot!
Anybody has an idea what's going on and what can cause this bug and the hardware corruption?
I know it could be a problem with my 3D card (geforce 6600) but the point is that, this particular line of code, and only this one, will always trigger the problem.
And I don't see anything there that should trigger a problem. As I said it's not a very intensie part of the program (there are much more intensive and complex algorythms in other places of the program) and the list of "source" objects is comprised of 3 objects at most.