X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=TP_13%2Fexo2%2Fsrc%2Fmain.c;h=bdc1ccd881172d9e3c206cd493e9001a6054e05d;hb=b395a2c7d3cab0ad9935c04a92271cc67cf8c358;hp=d57be23271c7e3d812ee9fba647d722fd4e7a02f;hpb=a177f80cdc31a9df8097f56a33ae1be7d24ef0af;p=TD_C.git diff --git a/TP_13/exo2/src/main.c b/TP_13/exo2/src/main.c index d57be23..bdc1ccd 100644 --- a/TP_13/exo2/src/main.c +++ b/TP_13/exo2/src/main.c @@ -17,13 +17,28 @@ int main() { char* exit_msg = malloc(str_max_length * sizeof(char)); initscr(); + if (has_colors() == false) { + endwin(); + printf("Votre terminal ne supporte pas les couleurs.\n"); + exit(EXIT_FAILURE); + } + start_color(); getmaxyx(stdscr, row, col); noecho(); curs_set(0); /* array of the active coordinates in the entered order */ - coordinates_t coordinates_array[MAX_COORDINATES]; - init_coordinates(coordinates_array); + coordinates_t coordinates_array[MAX_COORDINATES] = { + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0} + }; coordinates_t new_coordinates = {0, 0, 0}; /* center base coordinates for the board */ @@ -130,7 +145,7 @@ int main() { round = 0; player = 0; errno = 0; - reinit_coordinates(coordinates_array); + zero_coordinates(coordinates_array); winning_condition = false; loop_exit_condition = false; clear();