AutoGenerated IDs zero out in saved tables
Posted: Wed Dec 04, 2019 12:16 am
Hi,
I use Hollywood 8.0 on WinUAE with OS3.9 and AROS i-386. The following code saves some auto-generated brush ids in a table, prints them, saves the table, restores the table, and then prints the ids. The ids are zero when reprinted while I expected them to be saved and restored. I think I can find a workaround for my project but if this worked things would be much easier. It looks like a bug to me. Thanks.
@DISPLAY {hidden=True}
;global declarations
file$="SYS:System/Shell.info" ;path to a picture file; I've got an icon datatype
a={}
;load it three times
Function p_LoadBrushes()
a[0]=LoadBrush(Nil, file$)
a[1]=LoadBrush(Nil, file$)
a[2]=LoadBrush(Nil, file$)
EndFunction
Function p_BrushIds()
Local qty=ListItems(a)
DebugPrint("BrushIds, qty=", qty)
For Local i=0 To qty-1
DebugPrint(a)
Next
EndFunction
Function p_SaveTable()
OpenFile(1, "test", #MODE_WRITE)
WriteTable(1, a)
CloseFile(1)
EndFunction
Function p_RestoreTable()
a=Nil
CollectGarbage()
OpenFile(1, "test", #MODE_READ)
a=ReadTable(1)
CloseFile(1)
EndFunction
;execute
p_LoadBrushes()
p_BrushIds()
p_SaveTable()
p_RestoreTable()
p_BrushIds()
End()
HOLLYWOOD BRUSHIDTEST.HWS
BrushIds, qty= 3
UserData: 11dab9dc
UserData: 11dad0ec
UserData: 11dad50c
BrushIds, qty= 3
0
0
0
I use Hollywood 8.0 on WinUAE with OS3.9 and AROS i-386. The following code saves some auto-generated brush ids in a table, prints them, saves the table, restores the table, and then prints the ids. The ids are zero when reprinted while I expected them to be saved and restored. I think I can find a workaround for my project but if this worked things would be much easier. It looks like a bug to me. Thanks.
@DISPLAY {hidden=True}
;global declarations
file$="SYS:System/Shell.info" ;path to a picture file; I've got an icon datatype
a={}
;load it three times
Function p_LoadBrushes()
a[0]=LoadBrush(Nil, file$)
a[1]=LoadBrush(Nil, file$)
a[2]=LoadBrush(Nil, file$)
EndFunction
Function p_BrushIds()
Local qty=ListItems(a)
DebugPrint("BrushIds, qty=", qty)
For Local i=0 To qty-1
DebugPrint(a)
Next
EndFunction
Function p_SaveTable()
OpenFile(1, "test", #MODE_WRITE)
WriteTable(1, a)
CloseFile(1)
EndFunction
Function p_RestoreTable()
a=Nil
CollectGarbage()
OpenFile(1, "test", #MODE_READ)
a=ReadTable(1)
CloseFile(1)
EndFunction
;execute
p_LoadBrushes()
p_BrushIds()
p_SaveTable()
p_RestoreTable()
p_BrushIds()
End()
HOLLYWOOD BRUSHIDTEST.HWS
BrushIds, qty= 3
UserData: 11dab9dc
UserData: 11dad0ec
UserData: 11dad50c
BrushIds, qty= 3
0
0
0