TYPE Ship_Data
Nam AS STRING * 11
Siz AS _BYTE
Img AS _UNSIGNED _BYTE
Tons AS INTEGER
Hits AS INTEGER
Defn AS INTEGER
Cost AS INTEGER
Armor AS _BYTE
Engine AS _BYTE
Manuver AS _BYTE
Computer AS _BYTE
Shield AS _BYTE
Emc AS _BYTE
Weapon1 AS _BYTE
Weapon2 AS _BYTE
Weapon3 AS _BYTE
Weapon4 AS _BYTE
Count1 AS _BYTE
Count2 AS _BYTE
Count3 AS _BYTE
Count4 AS _BYTE
Special1 AS _BYTE
Special2 AS _BYTE
Special3 AS _BYTE
END TYPE
DIM SHARED Ship(5, 5) AS Ship_Data
Starting_Ships:
DATA "Scout",0,1,40,3,2,6,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0
DATA "Fighter",0,2,40,3,2,6,1,1,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0
DATA "Destroyer",1,7,200,18,1,36,1,1,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0
DATA "Bomber",1,8,200,18,1,36,1,1,1,0,0,0,3,0,0,0,1,0,0,0,0,0,0
DATA "Colony Ship",2,13,1000,100,0,200,1,1,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0
RESTORE Starting_Ships
read ship(0,0)
"Unexpected internal code reference to UDT" ?
I'm guessing it means I can not do what I wish too.
but I'm still curious as to why it won't allow it, as long as the data matches up.
to do in 1 line what will take many lines otherwise would seem logical.
I can do it the long way of course, I was just hoping for a simpler, faster, and shorter one liner way when the IDE displayed that error.
This fits into a "feature request" type of report.
Yeah, here is your work done for you ;D
Thanks Bplus, but thats how I wound up doing it for now anyway. Not sure I could use non fixed length string cause this data needs to be saved to a file and last I knew we couldn't write or read UDT variable length strings yet.
I rather thought it would work cause you can do that type of operation with a file,
OPEN "testfile.dat" FOR BINARY AS #1
PUT #1, , ships(0, 0)
'GET #1, , ships(0, 0)
CLOSE
and thats perfectly fine. So it was rather a surprise when READ complained.
Where would I submit that or could you take care of it Fellippe?
I rather thought it would work cause you can do that type of operation with a file,I ran into a similar issue working with TYPE variables, while working with a user defined vector endpoint variable. I could equate one variable to another and the whole thing would transfer, but I couldn't do any other math like operations without isolating the individual elements. QB64 has to know what it's working on. It's reading one element at a time and has to know where it's going or what's being done to it. With file inputs and overall equates it presumes proper element order and rolls with it.
OPEN "testfile.dat" FOR BINARY AS #1
PUT #1, , ships(0, 0)
'GET #1, , ships(0, 0)
CLOSE
and thats perfectly fine. So it was rather a surprise when READ complained.
BTW, given the project I'm into now, I'm kind of interested in where you're going with this.
If you've every played, or heard of, Master Of Orion (1994) thats what I'm shooting for. Nearly done with the basic game interfaces(menus). Now we'll see how far I can get in the logic aspect of the game, typically where I start to lose a project. Some of the logic I've figured out and some I can fake, but there are aspects that just baffle me. Getting the galactic distribution correct will be the first hurdle. I can get the individual systems to generate fairly correctly but getting them placed reasonably well I'm not sure on.