Question, Structure with parent and children

Just starting out? Need help? Post your questions and find answers here.
ShadowStorm
Enthusiast
Enthusiast
Posts: 303
Joined: Tue Feb 14, 2017 12:07 pm

Question, Structure with parent and children

Post 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
I am French, I do not speak English.
My apologies for the mistakes.

I have sometimes problems of expression
I am sometimes quite clumsy, please excuse me and let me know.
SMaag
Enthusiast
Enthusiast
Posts: 327
Joined: Sat Jan 14, 2023 6:55 pm
Location: Bavaria/Germany

Re: Question, Structure with parent and children

Post 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
ShadowStorm
Enthusiast
Enthusiast
Posts: 303
Joined: Tue Feb 14, 2017 12:07 pm

Re: Question, Structure with parent and children

Post 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()
I am French, I do not speak English.
My apologies for the mistakes.

I have sometimes problems of expression
I am sometimes quite clumsy, please excuse me and let me know.
User avatar
Demivec
Addict
Addict
Posts: 4281
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Question, Structure with parent and children

Post 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
  
SMaag
Enthusiast
Enthusiast
Posts: 327
Joined: Sat Jan 14, 2023 6:55 pm
Location: Bavaria/Germany

Re: Question, Structure with parent and children

Post by SMaag »

Code: Select all

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