Function loadmap_0001 ( f As String ) As map_type_0001 Ptr
Dim As map_type_0001 Ptr lmap = CAllocate ( Len ( map_type_0001 )) '' allocate space for map
Dim As Integer o = FreeFile
Open f For Binary As #o
With lmap[0] ' <-------- compiler stops here "expected identifier"
Get #o,, .filename ''
Get #o,, .tileset.filename ''
Get #o,, .rooms '' get the datas
.room = CAllocate ( .rooms * Len ( room_type_0001 )) '' allocate space for all rooms
Dim As Integer r, l, t 'loops :: room, layer, tile
Dim fs As uShort 'used to read a uShort value into an Integer; saving file space :: fileshrink
For r = 0 To .rooms - 1
Get #o,, .room[r].x ''
Get #o,, .room[r].y ''
Get #o,, .room[r].parallax '' get the datas
.room[r].layout = CAllocate(( 3 + .room[r].parallax ) * Len ( Integer )) '' allocate space for all layers
For l = 0 To ( 3 + .room[r].parallax ) - 1
.room[r].layout[l] = CAllocate(((( .room[r].x + 1 ) * .room[r].y ) + 1 ) * Len ( Integer ))
'' allocate space for layer tiles
For t = 0 To (( .room[r].x + 1 ) * .room[r].y ) + 1 - 1
Get #o,, fs
.room[r].layout[l][t] = fs '' fill each tile
Next
Next
Next
Close
Load_Image .tileset
End With
Function = lmap
End Function
''
'' WITH test
''
type MYTYPE
c as integer
d as double
e as string * 4
end type
dim shared t(10) as MYTYPE
t(0).c = 1
t(0).d = 2.0
t(0).e = "3"
i = 5
print t(0).c, t(0).d, t(0).e
with t(i)
.c = t(0).c
.d = t(0).d
.e = t(0).e
print .c, .d, .e
end with
print t(i).c, t(i).d, t(i).e
''-------------------
type bar
abc as integer
end type
type foo
bar as bar
end type
dim foo as foo
dim bar as bar
with foo
with .bar
.abc = 1234
end with
with bar
.abc = 5678
end with
print "1234 ="; .bar.abc
print "5678 ="; bar.abc
end with
sleep
i guess you can't have stuff like lmap[0] or *lmap, try doing something like
Pointers are not supported, yet. It was going to be changed, but there would be too many changes in the 0.14 release and nobody would download the next one ;).