diff options
Diffstat (limited to 'src/gen_tiles.c')
-rw-r--r-- | src/gen_tiles.c | 10 |
1 files changed, 7 insertions, 3 deletions
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; } |