diff --git a/src/jeu_humain.c b/src/jeu_humain.c index 4ca264e..20fea3b 100644 --- a/src/jeu_humain.c +++ b/src/jeu_humain.c @@ -5,15 +5,14 @@ #include "../include/jeu.h" #include "../include/jeu_humain.h" -#define DELAI_MS 100 +void attendre(int secondes) { + time_t start_time = time(NULL); -void attendre(int delai_ms) { - clock_t start_time = clock(); - while (((clock() - start_time) * 1000) / CLOCKS_PER_SEC < delai_ms) { - + while(difftime(time(NULL), start_time) < secondes) { + break; + } } -} void jouerModeHumain(struct EtatJeu *etatJeu) { while (1) { @@ -27,12 +26,12 @@ void jouerModeHumain(struct EtatJeu *etatJeu) { if (etatJeu->phase > 0 && !peutDeplacer(*etatJeu, etatJeu->tourJoueur)) { afficherVictoire(etatJeu->tourJoueur == 1 ? 2 : 1); while (!SourisCliquee()) { - attendre(DELAI_MS); + attendre(1); } break; } } - attendre(DELAI_MS); + attendre(1); } }