From e7a7a165e184bcfea385fbe1946751811ed5c691 Mon Sep 17 00:00:00 2001 From: torreblam Date: Sat, 23 Nov 2024 15:47:19 +0100 Subject: [PATCH] MAJ --- src/jeu_humain.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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); } }