aboutsummaryrefslogtreecommitdiff
path: root/src/gen_tiles.c
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2022-08-11 23:12:12 +0300
committerkartofen <mladenovnasko0@gmail.com>2022-08-11 23:12:12 +0300
commita756913a7134c207a7d29a1175a428b02f61b777 (patch)
treef462a6b9f5a324467973800c6315e3cd2b37e20f /src/gen_tiles.c
parent89a48fc3e7252e1c7941f86559ca00b38d525244 (diff)
minor bug fixes
Diffstat (limited to 'src/gen_tiles.c')
-rw-r--r--src/gen_tiles.c10
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;
}