Page 1 of 1

Posted: Tue Jan 07, 2003 3:43 pm
by BackupUser
Restored from previous forum. Originally posted by JohnDeHope3.

I want to hold a map in a structure, so I need a 2-dimension array like this...

Structure Terrain
Name.s
Walkable.b
CharacterSymbol.s
EndStructure

Structure Map
Name.s
Cells.Terrain[10,10]
EndStructure

This would give my map a 10x10 array of terrain cells. But it seems I cannot have a static, multidimensioned array in a structure.

My beef is that since a structure's size is fixed, and a static array's size is fixed, why can't I have a two-dimensional array of structures?

Posted: Tue Jan 07, 2003 5:41 pm
by BackupUser
Restored from previous forum. Originally posted by Kale.

change to:

Code: Select all

Structure Terrain
Name.s
Walkable.b
CharacterSymbol.s
EndStructure

Structure Map
Name.s
Dim Cells.Terrain(10,10)
EndStructure
--Kale

New to PureBasic and falling in Love! :)

Posted: Tue Jan 07, 2003 5:54 pm
by BackupUser
Restored from previous forum. Originally posted by fred.

damn, it will never work and compiler doesn't warn.. One check more to do...

Fred - AlphaSND

Posted: Tue Jan 07, 2003 5:57 pm
by BackupUser
Restored from previous forum. Originally posted by freak.

Kale, what you wrote is just wrong.
Did you ever test this?

There is only one solution. See here:

viewtopic.php?t=4512

Timo

Posted: Tue Jan 07, 2003 10:35 pm
by BackupUser
Restored from previous forum. Originally posted by JohnDeHope3.

Thanks guys, I will try the "array in a struct" with another struct to hold that struct approach.

Posted: Tue Jan 07, 2003 11:17 pm
by BackupUser
Restored from previous forum. Originally posted by Kale.

hmmm, i didn't test it properly (i had to shoot of back to work, tut tut...). The above code compiled fine for me and i thought it was right, looking at it now though,... yeah it'll never work :)

--Kale

New to PureBasic and falling in Love! :)