Links between objects in different tlists.

BlitzMax Forums/BlitzMax Programming/Links between objects in different tlists.

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

What is your aversion to the use of pointers? Type instances are pointers, anyway.

The way you're doing it is the way I do it in my own code. In my board game engine, every object has a Parent and a Child of the "Object" type. I simply set the parent or child of each object and then cast it back when I need it. For instance:

ObjectA:FirstType = New FirstType
ObjectB:SecondType = New SecondType

ObjectA.SetChild(ObjectB)
ObjectB.SetParent(ObjectA)

SecondType(ObjectA.GetChild()).SomeMethodFromSecondType()


Of course, if the Parent or Child will always be a specific Type, you can skip the casting and just have GetChild()/GetParent() return that type instead of an Object.

Exactly why is it you don't like using this method?

SpaceAce