fix: reset game timer on state reset and don't zero timers when stopping them

This commit is contained in:
2023-11-17 18:36:05 +02:00
parent 77435c5095
commit 40f5ccabbe
3 changed files with 2 additions and 4 deletions
+1 -2
View File
@@ -289,6 +289,7 @@ void reset_state(Cudoku *game) {
game->should_draw_selection = false;
game->should_highlight_mistakes = false;
game->has_won = false;
timer_reset(&game->timer);
}
bool check_win(Cudoku *game) {
@@ -564,8 +565,6 @@ void generate_random_board(Cudoku *game) {
}
remove_numbers(game);
timer_reset(&game->timer);
}
void reset_board(Cudoku *game) {
-1
View File
@@ -35,7 +35,6 @@ float timer_remaining(Timer *timer) {
}
void timer_stop(Timer *timer) {
timer->time = 0.0f;
timer->is_running = false;
}
+1 -1
View File
@@ -3,6 +3,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <sys/time.h>
extern struct timeval start_time;
typedef struct Timer {
@@ -11,7 +12,6 @@ typedef struct Timer {
bool is_running;
} Timer;
double get_time();
void start_internal_timer();
bool timer_ended(Timer *timer);