I've change your code to have Add_new_path as a method, and p1,p2 and ship are no longer ints.
Add_new_path would make more sense as a method, as you're applying it to an instance of ship; the advantage you have access to the instance without the need of passing it as an argument.
Although its up to you to have p1,p2, and ship as ints; they get treated as handles and you need to convert them back to their types to access their fields and methods, I thought it would be easier just to skip the whole integer handles bit.
Type Path
Field Id
Field x[102]
Field y[102]
Function Create:Path (Id, x1,y1,vx1,vy1,x2,y2,vx2,vy2)
Local n:Path = New Path
n.Id = Id
Return n
End Function
End Type
Type Ship
Field Id
Field x
Field y
Field List_id_path:Tlist = CreateList()
Field hImage:TImage
' ----------------------------------------------------------------------------------------------
Function Create:Ship (x,y, File$, p:Path)
Local n:Ship = New Ship
n.x = x
n.y = y
n.hImage = LoadImage (File$)
ListAddLast n.List_id_path, String.FromInt(p.id) '<- ok
Return n
End Function
Method Add_new_path (p:Path)
ListAddLast List_id_path, String.FromInt(p.id) '<- ok
End Method
End Type
p1:path = Path.Create (1,0,0,0,0,0,0,0,0)
p2:path = Path.Create (2,5,5,5,5,5,5,5,5)
s1:Ship = Ship.Create (1,1,"image.png", p1)
s1.Add_new_path (p2)
For Local id_path:String=EachIn s1.List_id_path
Print id_path
Next