TLink?

BlitzMax Forums/BlitzMax Programming/TLink?

Amon(Posted 2010) [#1]
Would I be right in saying that a TLink is a link to an object in a list?

Not exactly sure!


Jesse(Posted 2010) [#2]
yes, tlink is where the actual objects are stored. Tlist is just a type created to manipulate the chain of links(linked list).

Last edited 2010


Czar Flavius(Posted 2010) [#3]
The main use of a TLink, is where you have a type you want to store in a big list (aka main game object, big list of game objects). Store the TLink in a "me" field of the object, then to delete the object just tell the me link to Remove. In the simple case where other objects don't directly depend on this object, this is a fast and simple way to remove the object from your game.

It goes against some theoretical theory of something but it's a special case and gives good performance when the list is hundreds big and things are going in and out all the time. I remember Skully (I think it was him?) saying it boosted performance on his tile-based game, so it's definately not one of those useless micro-optimizations I'm obsessed with.