Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Nested User Defined Types

Author
Message
Captain GerBear
18
Years of Service
User Offline
Joined: 9th Jul 2006
Location:
Posted: 12th Jul 2006 23:35
Curious.. I'm really just starting to learn what User Defined types are, and how to make them work. I'm working on a piece of code that generates a map, and I'm not sure how to go about assigning the values within my UDT. This is basically what I've got.

TYPE TILE
FrameNo as INTEGER
Walkable as INTEGER
Animated as INTEGER
MapExit as INTEGER
END TYPE

Dim MapGrid (30,30,30) as TILE


So.. .. how do I say "Tile FrameNo at MapGrid(1,1,1) = 10"

I'm just unsure on the proper syntax
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 13th Jul 2006 01:18 Edited at: 13th Jul 2006 01:21
MapGrid(1,1,1).FrameNo = 10

Just to give you some idea of size of your array...

1 integer = 4 bytes
4 integers = 16 bytes

30 * 30 * 30 elements = 27,000 elements

27,000 elements * 16 bytes = 432 Kilobytes.

Not massive, but you need to consider it in case you plan to interrogate many elements in a cycle.



Captain GerBear
18
Years of Service
User Offline
Joined: 9th Jul 2006
Location:
Posted: 13th Jul 2006 02:44
Ah, no, the array holds the data for the entire map, but before I Start pulling elements from it, a quick check will be run to see which elements are actually on screen, so chances are the area that is actually read will be somewhere around 9 x 9 x 15 or so. Come to think of it, I can probably limit the Z value even more tightly

Login to post a reply

Server time is: 2024-11-27 15:46:39
Your offset time is: 2024-11-27 15:46:39