|
@@ -25,6 +25,7 @@ void MineField::timerTick() {
|
|
|
timerSignal.emit(m_time);
|
|
timerSignal.emit(m_time);
|
|
|
start = std::chrono::system_clock::now();
|
|
start = std::chrono::system_clock::now();
|
|
|
}
|
|
}
|
|
|
|
|
+ //I should use std::duration to represent the time instead
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void MineField::initBombs(int x, int y) {
|
|
void MineField::initBombs(int x, int y) {
|
|
@@ -46,7 +47,7 @@ void MineField::initBombs(int x, int y) {
|
|
|
//init the timer to zero and start the timer thread
|
|
//init the timer to zero and start the timer thread
|
|
|
m_time = 0;
|
|
m_time = 0;
|
|
|
timerThread = std::thread(&MineField::timerTick, this);
|
|
timerThread = std::thread(&MineField::timerTick, this);
|
|
|
- timerThread.detach(); //not sure if this is okay
|
|
|
|
|
|
|
+ timerThread.detach(); //not sure if this is okay (better to call join() when I set the condition to stop the thread)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool MineField::openCell(int x, int y) {
|
|
bool MineField::openCell(int x, int y) {
|