Page 1 of 1

Question, Structure with parent and children

Posted: Sun Feb 16, 2025 1:22 pm
by ShadowStorm
Hi, could you please tell me what the differences are between these 3 structures, and how to use them ?

Code: Select all

Structure VirtualObject
  *Parent.VirtualObject
  List *Children.VirtualObject()
EndStructure

Global CurrentID.i = 0
Global NewMap ObjectMap.i()

Code: Select all

Structure VirtualObject
  *Parent.VirtualObject
  List *Children.VirtualObject()
EndStructure

Global NewMap ObjectMap.VirtualObject()
Global CurrentID.i = 0

Code: Select all

Structure VirtualObject
  *Parent.VirtualObject
  List Children.i()
EndStructure

Global NewMap ObjectMap.VirtualObject()
Global CurrentID.i = 0

Re: Question, Structure with parent and children

Posted: Sun Feb 16, 2025 1:55 pm
by SMaag

Code: Select all

  *Parent.VirtualObject           ; Pointer to the Parent Object-Structure
  List *Children.VirtualObject()  ; List of ChildObjects, wehre all Object Datas are Stored in the List
  List Children.i()               ; List Of Children ID's or Pointers
 
  Global NewMap ObjectMap.i()               ; ObjectMap which store an Integer, problably the Object ID or a Pointer
  Global NewMap ObjectMap.VirtualObject()   ; ObjectMap where all Objects Data stored in the Map

Re: Question, Structure with parent and children

Posted: Sun Feb 16, 2025 8:10 pm
by ShadowStorm
Thank you SMaag.

What approach is best for managing parents and children ?
so this ?:

Code: Select all

Structure VirtualObject
  *Parent.VirtualObject
  List *Children.VirtualObject()
EndStructure

Global NewMap ObjectMap.VirtualObject()

Re: Question, Structure with parent and children

Posted: Mon Feb 17, 2025 4:33 am
by Demivec
SMaag wrote: Sun Feb 16, 2025 1:55 pm

Code: Select all

  *Parent.VirtualObject           ; Pointer to the Parent Object-Structure
  List *Children.VirtualObject()  ; List of ChildObjects, wehre all Object Datas are Stored in the List
  List Children.i()               ; List Of Children ID's or Pointers
 
  Global NewMap ObjectMap.i()               ; ObjectMap which store an Integer, problably the Object ID or a Pointer
  Global NewMap ObjectMap.VirtualObject()   ; ObjectMap where all Objects Data stored in the Map
@SMaag: In your descriptions I believe you made one mistake.

Code: Select all

  ;The description
  List *Children.VirtualObject()  ; List of ChildObjects, wehre all Object Datas are Stored in the List
  ;is more accurately described as
  List *Children.VirtualObject()  ; List of pointers to ChildObjects
  

Re: Question, Structure with parent and children

Posted: Mon Feb 17, 2025 5:31 pm
by SMaag

Code: Select all

List *Children.VirtualObject()
Yes I forgott the * first: it's a List of Pointer to VirtualObject Structures