From bad8e571dd6a02425d3d50464b8f96b99ee080af Mon Sep 17 00:00:00 2001 From: matthew Date: Sat, 4 Aug 2018 12:55:56 +0100 Subject: [PATCH] fixed incorrect size being malloc'd for tiles --- common/board.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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; -- 2.20.1