GLBasic forum

Main forum => Bug Reports => Topic started by: BigAnd on 2009-Oct-24

Title: DIMDATA Crash
Post by: BigAnd on 2009-Oct-24
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.
Title: Re: DIMDATA Crash
Post by: MrTAToad on 2009-Oct-24
Can you make the DIMDATA lines available ?
Title: Re: DIMDATA Crash
Post by: BigAnd on 2009-Oct-24
Here you go. (http://www.andynoble.co.uk/DimData.gbas) It exceeded the maximum characters for a post.
Title: Re: DIMDATA Crash
Post by: Moru on 2009-Oct-24
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
Title: Re: DIMDATA Crash
Post by: BigAnd on 2009-Oct-24
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.
Title: Re: DIMDATA Crash
Post by: MrTAToad on 2009-Oct-24
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
Title: Re: DIMDATA Crash
Post by: Kitty Hello on 2009-Oct-26
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.
Title: Re: DIMDATA Crash
Post by: MrTAToad on 2009-Oct-26
You cant get out of it that easily :)
Title: Re: DIMDATA Crash
Post by: Kitty Hello on 2009-Oct-26
bugs only happening in release are about a day to debug each. I don't have that time. :(
Title: Re: DIMDATA Crash
Post by: bigsofty on 2009-Oct-26
Quote from: BigAnd on 2009-Oct-24
Here you go. (http://www.andynoble.co.uk/DimData.gbas) 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
Title: Re: DIMDATA Crash
Post by: BigAnd on 2009-Oct-26
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.
Title: Re: DIMDATA Crash
Post by: MrTAToad on 2009-Oct-26
Hopefully at some point in the not-too-distance future, it'll be fixed in release mode...