I've been working with Types recently and they've been working fine for the most part, but I've discovered what I believe to be a bug.
The code below clearly demonstrates the problem - I create 10 Types, positioning them all at 5,5. In theory every Type should iterate at exactly the same position. However Type[0] ALWAYS appears at position 0,0 - the other Types work fine,
No matter what other fields are in the Type, Type[0] always appears at 0,0 - its other fields are active and work fine though.
SETSCREEN 320,240,1
// Test Type
TYPE test_type
x
y
num
ENDTYPE
GLOBAL tt[] AS test_type
DIM tt[100]
FOR n=0 TO 10
create_test(n)
NEXT
main()
END
// Main
FUNCTION main:
WHILE TRUE
DRAWRECT 0,0,320,240,RGB(255,255,255)
render_test()
SHOWSCREEN
WEND
ENDFUNCTION
// Create test Type
FUNCTION create_test: n
tt[n].num=n
tt[n].x=5
tt[n].y=5
ENDFUNCTION
// Render Test Types
FUNCTION render_test:
FOREACH item IN tt[]
PRINT item.num,item.x,item.y
NEXT
ENDFUNCTION
Is this a bug or a problem with my coding? until now I've been working around it and only displaying Types with a value over zero. But this can't be right. Can it?