Array of Type

Blitz3D Forums/Blitz3D Programming/Array of Type

Blitz doesn't natively let you create separate lists of the same type - I believe BMax does, though. However, this is easily solved by implementing your own separate linked lists of types.

Given your example, you would first need to expand the aiPath type:
Type aiPath
  Field x,y
  Field link.aiPath
End Type


Now create an array to hold the pointers to each individual linked list:
Dim path.aiPath(unitQty)


Now, create a new instance and add it to 'player1' linked list:
point.aiPath = New aiPath
point\x = blah
point\y = blah
point\link = path(player1)
path(player1) = point


To iterate through player1's entire path:
point.aiPath = path(player1)
While point <> Null
  ; Do stuff with this point here.

  ; Get next point in linked list.
  point = point\link
Wend


Well, that's the basic idea, anyway. :)

Also, have a look at my post in this thread for a similar method except it implements the working of an actual stack:
http://www.blitzbasic.com/Community/posts.php?topic=48442#539401