Compiler fail or my fail?

BlitzMax Forums/BlitzMax Programming/Compiler fail or my fail?

Pineapple(Posted 2010) [#1]
I've got a line of code:

If in(count[k],s.n) Then fut[xx,yy]=Byte(s.r)

in() is a parsing function to see if count[] fits a condition - for example, count[] might be 5, and s.n might be "5|7". It would return 1, because of how the parsing works (the condition is "5 or 7", of couse)

fut[,] is what my array representing the field is going to be. I have another array, grid[,] that represents it as it is now.

Byte(s.r) is what fut[xx,yy] needs to become if that condition is met.

Here's where things get really freaky.

I can put a fut[xx,yy]=grid[xx,yy] before this line of code, and it's always true. This isn't a bad thing - I'm copying the data from grid to fut just before this.

I can but the same fut[xx,yy]=grid[xx,yy] directly after the line of code and it's still always true. Not what I want, but it would just mean the condition isn't being met or fut[xx,yy] is being assigned to a value it is already, right?

Wrong.

First off, there is no circumstance in which fut[xx,yy] would be equivalent to Byte(s.r) before this statement.

More remarkably, when I change the code to this:

Local p%=fut[xx,yy]
If in(count[k],s.n) Then fut[xx,yy]=Byte(s.r)
If p<>fut[xx,yy] Print "!?"

It prints "!?" many times - in fact - more times than the condition can possibly be met.




What the HECK is going on here?


Pineapple(Posted 2010) [#2]
Problem solved:

fut[,]=grid[x,y] makes it so when you set fut[4,4] to 1, for example, it does the same operation to grid[4,4].