• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

SOLVED Ds grid chaning size and crashing game

Fabseven

Member
Hello there,
got a strange problem.

In my game when using "Enter" i show a menu with multiples things
The game is composed of multiples randoms stages so i use some dsgrid and dslist, etc

When i changing stage 5-6 times and access the menu the game crash

draw_sprite_ext argument 2 incorrect type (undefined) expecting a Number (YYGI32)
at gml_Object_obj_system_DrawGUI_3 (line 50) - draw_sprite_ext(obj_hero.stuff[#i,SPR],obj_hero.stuff[#i,SPRN],menu_hero_stuff[i,3],menu_hero_stuff[i,4],2,2,0,c_white,1)
############################################################################################
--------------------------------------------------------------------------------------------

In the log i can see why :
Grid 4, index out of bounds writing [0,13] - size is [3,3]
Grid 4, index out of bounds writing [0,12] - size is [3,3]

Here is the problem : the grid is create one time with 4,50
Why is it reduced to 3,3 and crushing the game ?
a show_debug_message( string( ds_grid_height()) show that the size is indeed reduced at 3
 

Fabseven

Member
Man, solved.
I check my code i think it's because i used ds_grid_destroy on a mp_grid and so after a few times there is this bug ?
 

FrostyCat

Redemption Seeker
Man, solved.
I check my code i think it's because i used ds_grid_destroy on a mp_grid and so after a few times there is this bug ?
This isn't a bug. If you had a motion planning grid to get rid of, you should have used mp_grid_destroy() on its ID. Using ds_grid_destroy() on a motion planning grid ID will destroy an unrelated grid data structure with the same numeric ID instead, the result of which is undefined behaviour.
 
Top