From: matthew Date: Sat, 4 Aug 2018 11:55:56 +0000 (+0100) Subject: fixed incorrect size being malloc'd for tiles X-Git-Url: https://git.owens.tech/assets/me.png/assets/me.png/git?a=commitdiff_plain;h=bad8e571dd6a02425d3d50464b8f96b99ee080af;p=csrpg.git fixed incorrect size being malloc'd for tiles --- diff --git a/common/board.c b/common/board.c index 31c178d..08214c4 100644 --- a/common/board.c +++ b/common/board.c @@ -21,15 +21,13 @@ Board *board_init(Point2i size) b->dimensions.x = size.x; b->dimensions.y = size.y; - b->tiles = malloc(size.x * size.y * sizeof(Tile)); + b->tiles = malloc(sizeof(Tile *) * size.x * size.y); for(int y = 0; y < size.y; ++y){ for(int x = 0; x < size.x; ++x){ itr = flatten(point2i(x, y), size); - printf("%d\t", itr); b->tiles[itr] = tile_init(point3i(x, y, itr), PLAIN); } - printf("\n"); } ret = (Board *) b;