DIMDATA Crash

Previous topic - Next topic

BigAnd

When I have a huge DIMDATA spread over multiple lines using the " _", gpc.exe crashes.

When I say huge I mean nearly 1000 lines of 32 ints.
I don't really want to resort to loading them in from a binary file as the data is still being tweaked.

MrTAToad

Can you make the DIMDATA lines available ?

BigAnd

Here you go. It exceeded the maximum characters for a post.

Moru

Dimdata is realy only for very small amounts of data, for easy storage of levels, try this approach:

Code (glbasic) Select

GLOBAL level[]
GLOBAL w, h
loadlevel()

WHILE 1
drawscreen()
SHOWSCREEN
WEND


FUNCTION drawscreen:
FOR y = 0 TO h-1
FOR x = 0 TO w-1
PRINT " "+level[x][y], x*20, y*20
NEXT
NEXT
ENDFUNCTION

FUNCTION loadlevel:
LOCAL a

RESTORE level1
READ w // Get the size of the level
READ h
REDIM level[w][h] // New size of array
FOR y = 0 TO h-1
FOR x = 0 TO w-1
READ a // Read data for one cell
level[x][y] = a
NEXT
NEXT
ENDFUNCTION

STARTDATA level1:
DATA 4, 5 // width and height
DATA 0, 0, 0, 1 // Level data
DATA 0, 0, 0, 1
DATA 0, 0, 0, 1
DATA 0, 0, 0, 1
DATA 0, 0, 0, 1
ENDDATA

BigAnd

Cheers Moru.

Yeah, I know that approach. I just wanted a simple data set while I was starting development and the DIMDATA was perfect for it. In the end the data will be loaded as binary anyway. I was just pointing out there might be a problem with the compiler.

Cheers again.

MrTAToad

#5
Well, I don't think the compiler should crash...

It appears DIMDATA can take up to 24394 items.  Its a rather odd number, but one item more and the compiler crashes

Kitty Hello

Great! The debug version does run. It's only the release that crashes. I'd be happy if you could make DIMDATA with DIM and a loop instead.

MrTAToad

You cant get out of it that easily :)

Kitty Hello

bugs only happening in release are about a day to debug each. I don't have that time. :(

bigsofty

Quote from: BigAnd on 2009-Oct-24
Here you go. It exceeded the maximum characters for a post.

Yikes! That's quite possibly the biggest single line I have ever seen in a program listing! :P
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

BigAnd

LOL! Yeah it is a bit big!
I have a work around at the moment anyway. I am hosting my data in BlitzMax, it writes out a binary file and then copies it into my media directory. It works well and is really only one extra button press.

MrTAToad

Hopefully at some point in the not-too-distance future, it'll be fixed in release mode...