From e2f3dfb1b03370a2359416bd46117068b204228d Mon Sep 17 00:00:00 2001 From: TheRedBlueCube3 Date: Sun, 22 Jun 2025 00:29:38 +0300 Subject: [PATCH] forgot something --- src/main.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index d215bed..2075fcf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,7 +19,7 @@ void startGame(Board &board) bool gameRunning = true; time_t startTime = time(nullptr); - int elapsedTime; + int elapsedTime = 0; bool isPaused = false; time_t startPauseTime = 0; @@ -27,11 +27,14 @@ void startGame(Board &board) time_t totalpausetime = 0; while (gameRunning) { + usleep((1000 / MAX_TIME) * 1000); if (board.isGameOver() || board.isGameWon()) { gameRunning = false; } + if (!isPaused) + elapsedTime = difftime(time(NULL), startTime) - totalpausetime; char flags[5]; char tim[5]; sprintf(flags, "%03d", minesLeft); @@ -184,8 +187,6 @@ void startGame(Board &board) if (isPaused) continue; - elapsedTime = difftime(time(NULL), startTime) - totalpausetime; - refresh(); }