Linkedlist extension

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by stfighter.

i need a command to mirror the content of a linked list to another linked list
i need to make 2 or more selections in the list at the same time (to compare 2 parts of the list )
i thought about something like this :

Newlist objekte.objekt() ;Create a linked list

addelement(objekte.objekt())
addelement(objekte.objekt())
.
.
;---- fill list with something ----

Newlist temp.objekt() ; create a 2nd list

Mirrorlist(objekte(),temp())
;make a mirror form the objekte list to the temp list
;but don't copy the content

selectelement(objekte(),4)
selectelement(temp(),2)

if temp()\x= objekte()\x and temp()\y=objekte()\y
makebigbigexplosion()
endif


P.S.: sorry because my english ist very bad
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Pupil.

You can do this with a pointer like this:

Code: Select all

  ...
SelectElement(objekte(), 4)
*ptr.objekt = @objekte()
SelectElement(objekte(), 2)

If *ptr\x = objekte()\x and *ptr\y = objekte()\y
  ...
EndIf
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by stfighter.

Yes, thats right, but it is not very comfortable and it ist very slow to switch 1000 times in the linklist

i think about something like the Types ind *wisper.. blitzbasic (i didn't say this :wink:
i use linklists very often and this would make my work much easier.

this is a wishlist, and this is my wish 8)

mfg stfighter
Post Reply