All pastes #349679 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-02-10 23:54 UTC
rendered paste body
SuperStrict


'Movable object:

Type tMovableObject 'We need this to be linkable to the LBEntity
	Field UserData:Object
	
End Type


'LBentity object.

Type LBentity
	Field Pointer:Int
End Type


Type UserData	'userdata object that links the above two. doing it this way enables us to easily add more user specified data later on in new fields/members.
	Field Entity:Lbentity
End Type


Global MO:tMovableObject=New tmovableobject

'Create an LBEntity and give it a value in its pointer to test later.

Global LBEnt:LBentity=New LBentity
LBEnt.Pointer=256

'How do I link MO to LBE? here goes:

'First create a userData object
Local UD:UserData=New UserData
'Set its Entity field to the entity we want to link it with
ud.entity=LBEnt

'Set the userdata field of the MO to this userdata object.
MO.UserData=UD



'How to retreive the LB entity of an MO?

Local LBEent:LBEntity=LBEntity(Userdata(MO.UserData).Entity)

Notify LBEnt.Pointer