ok, this one has me completely stumped. somehow a variable is getting set by a block of code that doesnt even mention that variable. take a look:
these asserts both fail every time. i explicitly set the values equal to what i want to be, but every time that for loop is run, they get changed. i put some break points and ran it through the debugger, and i watched it magically change the wrong values. somehow on the last run of the for loop, deck[i] ( in this case, deck[52] ) is effecting the first two indexes of board.Code:board[0].x = BoardPosX; board[1].x = BoardPosX; for ( int i = 39; i < 53; ++i ) { deck[i].val = i - 39; deck[i].suit = 3; deck[i].X = i * 12; deck[i].Y = 10; deck[i].selected = FALSE; deck[i].played = FALSE; deck[i].overturned = FALSE; } assert ( board[0].x == BoardPosX ); assert ( board[1].x == BoardPosX );
is it possible for the OS to screw up and allocate two different arrays in the same chunk of memory? neither of the arrays are dynamic, and my memory usage is normal. i really cant figure this one out...