Given this type where member vtx is an array:
type mpTile
vtx as matMatrix[]
bbX as float
bbY as float
endtype // mpTile
I use this type as a member of another type. In this block of code:
for r = 0 to map.tiles.length
for q = 0 to map.tiles[0].length
if tileShape = HEXES
/*
do
Print(map.tiles[r, q].vtx.length)
map.tiles[r, q].vtx.length = 5
Sync()
loop
*/
map.tiles[r, q].vtx.length = 5
for v = 0 to 5
map.tiles[r, q].vtx[v] = matMatrixMultiply(matMatrixCreateTranslate2dH((q * map.tW) + (0.5 * map.tW * r), r * 0.75 * map.tH), base.vtx[v])
next v
endif
next q
next r
The operation crashes when attempting to adjust vtx.length since object vtx is empty. However, if I uncomment the do-loop, this exact same command works correctly in there. Given that this was an issue, I also attempted to rewrite the `map.tiles[r, q].vtx[v] =` command to use vtx.insert() instead, but I get the same crash. The error complains about addressing element 0 in an empty array, and by using Print statements I can confirm that only array vtx is empty at this point in program execution, yet operations that should be fine to use on empty arrays fail here. I'm not sure if this is a bug or I'm just doing something wrong.
Goo Goo G\'Joob!