From a756913a7134c207a7d29a1175a428b02f61b777 Mon Sep 17 00:00:00 2001 From: kartofen Date: Thu, 11 Aug 2022 23:12:12 +0300 Subject: minor bug fixes --- src/gen_tiles.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/gen_tiles.c') diff --git a/src/gen_tiles.c b/src/gen_tiles.c index de07f30..f7e030e 100644 --- a/src/gen_tiles.c +++ b/src/gen_tiles.c @@ -90,15 +90,19 @@ void save(small_t *t, small_t *c, int n, int i) fwrite(&connections, sizeof(connections), 1, fp); } -void gen_rotations() +void gen() { mkdir("files", S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); mkdir("files/tiles", S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); fp = fopen("files/tiles/tiles.dat", "wb"); + if(!fp) { + fprintf(stderr, "ERROR: Could not open file files/tiles/tiles.dat"); + exit(EXIT_FAILURE); + } size_t tiles_sz = sizeof(tiles_to_load)/sizeof(int); - fwrite(&tiles_sz, sizeof(size_t), sizeof(size_t), fp); + fwrite(&tiles_sz, sizeof(size_t), 1, fp); char syms[TILE_TYPES]; size_t sym_sz = 0; @@ -118,6 +122,6 @@ void gen_rotations() int main(void) { - gen_rotations(); + gen(); return 0; } -- cgit v1.2.3