Array of TList

BlitzMax Forums/BlitzMax Programming/Array of TList

Chroma(Posted 2008) [#1]
Is anyone else using TList in this manner? Just wanna make sure it's safe.

Type TBlah
   Field MyList:TList[]
End Type



grable(Posted 2008) [#2]
Its as safe as any other usage of TList.


Chroma(Posted 2008) [#3]
And when you're creating the TBlah and you want to set the size of the array...how would you do that?


Czar Flavius(Posted 2008) [#4]
Edit: this was wrong.


Czar Flavius(Posted 2008) [#5]
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.


Chroma(Posted 2008) [#6]
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]



Dreamora(Posted 2008) [#7]
you can even do TLists of TList as TList is just a class.


Chroma(Posted 2008) [#8]
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.


Czar Flavius(Posted 2008) [#9]
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.