This commit is contained in:
Rorikstr | Rust Dev 2025-10-01 00:05:04 +03:00
parent cc6f9bb2d1
commit 7694d697e7
2 changed files with 3 additions and 2 deletions

1
.gitignore vendored
View file

@ -59,3 +59,4 @@ src/ginpee.toml
.vscode/launch.json .vscode/launch.json
src/tetris.log src/tetris.log
src/high_score.txt src/high_score.txt
src/build/high_score.txt

View file

@ -1,7 +1,7 @@
#include "01_automato.h" #include "01_automato.h"
int load_high_score() { int load_high_score() {
FILE* file = fopen("high_score.txt", "r"); FILE* file = fopen("build/high_score.txt", "r");
int high_score = 0; int high_score = 0;
if (file) { if (file) {
if (fscanf(file, "%d", &high_score) != 1) { if (fscanf(file, "%d", &high_score) != 1) {
@ -13,7 +13,7 @@ int load_high_score() {
} }
void save_high_score(int score) { void save_high_score(int score) {
FILE* file = fopen("high_score.txt", "w"); FILE* file = fopen("build/high_score.txt", "w");
if (file) { if (file) {
fprintf(file, "%d", score); fprintf(file, "%d", score);
fclose(file); fclose(file);