Help with blitz arrays

Blitz3D Forums/Blitz3D Programming/Help with blitz arrays

Ross C(Posted 2007) [#1]
I'm having a bit of a problem. Working away on my pathfinding stuff, and at the beginning i define a number of nodes (or waypoints) i use. Now, in my types, i want to do this:


Type node
   Field path_history[number_of_nodes]
End Type



I missed out some of the fields i use, as they don't demonstrate my problem :o)

Now, i understand why this doesn't work, as the array can't be changed once it's been created. But, i kind of need to do this, create the array, based on a number that will be read from data statements, or a file. Any way to circumvent this?


big10p(Posted 2007) [#2]
I have the same kind of issue with my current project.

You can set your array size to the maximum that will be needed, although this is hardly ideal as every instance will contain an array of that size - could get expensive on memory.

Or, you can use a bank instead of an array. Banks are slower that arrays, though.

I plumped for using arrays as speed was more important to me.


Ross C(Posted 2007) [#3]
Speed is more important as well. I'll just stick 5000 in. I don't think i'll be using more nodes than that. Thanks man :o)