correct grid malloc to calloc
This commit is contained in:
parent
b7c45f7f87
commit
44bc1cbe87
|
@ -190,12 +190,12 @@ struct gamestate* gamestate_init(struct gameoptions *opt)
|
|||
//long *grid_back = malloc(opt->grid_width * opt->grid_height * sizeof(long));
|
||||
//if (!grid_back) goto grid_back_alloc_fail;
|
||||
|
||||
g->grid = malloc(opt->grid_width * sizeof(long*));
|
||||
g->grid = malloc(opt->grid_width, sizeof(long*));
|
||||
if (!g->grid) goto grid_alloc_fail;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < opt->grid_height; ++i)
|
||||
g->grid[i] = malloc(opt->grid_height * sizeof(long));
|
||||
g->grid[i] = calloc(opt->grid_height, sizeof(long));
|
||||
|
||||
g->moved = 0;
|
||||
g->score = 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user