Game state is now preserved in a file
This commit is contained in:
@@ -176,6 +176,11 @@ void reset_board(GameState_t *state) {
|
||||
state->board[y][x] = (rand() % 10 == 0) ? 4 : 2; // 10% chance to spawn a 4
|
||||
tile_count++;
|
||||
}
|
||||
FILE *f = fopen("save.dat", "wb");
|
||||
if (f) {
|
||||
fwrite(state, sizeof(GameState_t), 1, f);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
||||
bool spawn_tile(GameState_t *state) {
|
||||
|
||||
Reference in New Issue
Block a user