diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8f5ca8b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/2048* diff --git a/Makefile b/Makefile index 92c2ff5..dc28d95 100644 --- a/Makefile +++ b/Makefile @@ -5,10 +5,10 @@ LIBS = -lcurses all: 2048 2048: src/2048.c src/2048.h src/highscore_file.c - $(CC) $(CFLAGS) src/2048.c src/highscore_file.c -o 2048 $(LIBS) + $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) src/2048.c src/highscore_file.c -o 2048 2048nc: src/2048_no_curses.c src/2048.h src/highscore_file.c - $(CC) $(CFLAGS) src/2048_no_curses.c src/highscore_file.c -o 2048nc + $(CC) $(CFLAGS) $(LDFLAGS) src/2048_no_curses.c src/highscore_file.c -o 2048nc clean: rm -f 2048 2048nc diff --git a/src/2048.c b/src/2048.c index 4f18260..d1c8f1c 100644 --- a/src/2048.c +++ b/src/2048.c @@ -163,7 +163,7 @@ int get_score_high() { if (fd == NULL) fd = fopen(HISCORE_FILE, "w+"); - fscanf(fd, "%d", &s); + if (fscanf(fd, "%d", &s) == 1) {}; fclose(fd); return s; }