Array of TList

BlitzMax Forums/BlitzMax Programming/Array of TList

Is anyone else using TList in this manner? Just wanna make sure it's safe.

Type TBlah
   Field MyList:TList[]
End Type


Its as safe as any other usage of TList.

And when you're creating the TBlah and you want to set the size of the array...how would you do that?

Edit: this was wrong.

MyBlah.MyList = New TList[size]
For Local I:Int = 0 Until MyBlah.MyList.length
   MyBlah.MyList[i] = New TList
Next


On the first line I'm not sure if MyList requires [] or not.

I'm creating the original array as []. Now when I actually create my TBlah, I want to define the size of MyList[]. I don't care about creating new MyLists I'm talking about setting MyList from MyList[] to MyList[20]. So I can store 20 lists in that list.

I'm trying to get the best way to go from MyList[] to MyList[20].
MyList[] = New TList[20]


Ahhhh...it's:
MyList = New TList[20]


you can even do TLists of TList as TList is just a class.

Cool. What I'm doing here is instead of just have a master tile list and only rendering a tile if visible=1, I'm batching the tiles together into separate lists and making it so I can render specific lists only. That way I'm avoiding cycling through 90 tiles, because I'm only showing probably 6-20 tiles at a time.

You could store the tiles in a 2d array and only render the tiles which are visable on the screen. Arrays can jump to any tile, so you don't need to render all of them.