Identical Arrays not identical

BlitzMax Forums/BlitzMax Programming/Identical Arrays not identical

MattVonFat(Posted 2005) [#1]
I have four Arrays that are indentical - [60,60]. I set each value in all four to True at the same time. I then set the same values to False at the same time:

For CountC = 1 To 553
    Local X, Y
    ReadData X, Y
    Shield1[X,Y] = False
    Shield2[X,Y] = False
    Shield3[X,Y] = False
    Shield4[X,Y] = False
Next


But when i access them it turns out that they aren't identical. 1 and 3 are identical, 2 and 4 are identical but aren't how they should be (because i'm plotting the True values and 2 and 4 have got a whole diagonal chunk missing from the image).

I have tried changing where they are but that didn't work and in the above code i tried to set it up as:

For CountC = 1 To 553
	Local X, Y
	ReadData X, Y
	Shield1[X,Y] = False
	Shield2[X,Y] = Shield1[X,Y]
	Shield3[X,Y] = False
	Shield4[X,Y] = Shield1[X,Y]
Next


But that didn't work either. After i set the False values i only access them to draw them so i can't see what's going wrong?

Can anyone help?


Who was John Galt?(Posted 2005) [#2]
I'll have a look if u post a working example.


MattVonFat(Posted 2005) [#3]
Ok thanks, here's the whole code:



The length is just because of all the datastatements i have in there atm.


Perturbatio(Posted 2005) [#4]
first thing I've spotted is that your for loops are going 1 to 60 not 0 to 59 so you will get an attempt to index beyond array length error.


MattVonFat(Posted 2005) [#5]
Ah. Well 0 to 59 sort of solved the problem but the image still looked a bit strange but 1 to 59 seemed to work. Wow that was confusing...

Thanks for the help!