From 985a9e81da1523a4c39d42ece565aaad550ca2cc Mon Sep 17 00:00:00 2001 From: proal Date: Sun, 4 Dec 2022 17:36:36 +0100 Subject: [PATCH] tout fonctionne. On a fini. --- cheat.c | 14 ++++++++++++-- cheat.h | 2 +- jeu.c | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/cheat.c b/cheat.c index 1b45c1f..d9236d7 100644 --- a/cheat.c +++ b/cheat.c @@ -3,8 +3,9 @@ #include #include "cheat.h" -int cheat(int affichage[50],int tab[40]){ +int cheat(int affichage[50],int tab[40], int sauv_pos[40]){ int x,n,pos_x,pos_y; + int i, oui; while(n<1){ x=0; for (pos_y=10;pos_y<=370;pos_y=pos_y+90){ @@ -26,7 +27,16 @@ int cheat(int affichage[50],int tab[40]){ pos_x=650; pos_y=1000; } - ChargerImage("Images/image0.png",pos_x,pos_y,0,0,80,80); + oui=0; + for (i=0;i<40;i++){ + if (sauv_pos[i]==pos_x && sauv_pos[i+1]==pos_y){ + oui=1; + } + } + + if (oui==0){ + ChargerImage("Images/image0.png",pos_x,pos_y,0,0,80,80); + } x++; } } diff --git a/cheat.h b/cheat.h index 4c0f509..43691eb 100644 --- a/cheat.h +++ b/cheat.h @@ -1,6 +1,6 @@ #ifndef CHEAT_H #define CHEAT_H -int cheat(int affichage[50],int tab[40]); +int cheat(int affichage[50],int tab[40], int sauv_pos[40]); #endif \ No newline at end of file diff --git a/jeu.c b/jeu.c index 46cd5dd..5bef88d 100644 --- a/jeu.c +++ b/jeu.c @@ -65,7 +65,7 @@ int jeu(int position[20][4], int nb_paires,int tab[40]){ /*Triche*/ if(ToucheEnAttente() && Touche()==XK_t){ - n=cheat(affichage,tab); + n=cheat(affichage,tab, sauv_pos); } /*Clic de la souris*/