From 21885b0f99f0be3c189d0951aa10a0ee9a49387b Mon Sep 17 00:00:00 2001 From: Aubin DORIVAL Date: Thu, 12 Dec 2024 20:46:48 +0100 Subject: [PATCH] fix size play dinamic --- function.c | 4 ++-- function.h | 2 +- main.c | 12 +++++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/function.c b/function.c index 94da0bb..35aac33 100644 --- a/function.c +++ b/function.c @@ -156,7 +156,7 @@ void move (unsigned short int **tab, vect *playerPos, vect direction) } } -void inGameLoop (unsigned short int **tab2d, vect *playerPos, vect *targets, int nbr_targets) +void inGameLoop (unsigned short int **tab2d, int N, vect *playerPos, vect *targets, int nbr_targets) { vect direction = { 0, 0 }; char input; @@ -205,7 +205,7 @@ void inGameLoop (unsigned short int **tab2d, vect *playerPos, vect *targets, int { finish = true; } - screenDisplay (tab2d, 32); + screenDisplay (tab2d, N); } } diff --git a/function.h b/function.h index a18eb0e..eaec2ab 100644 --- a/function.h +++ b/function.h @@ -20,7 +20,7 @@ typedef struct Vecteur unsigned short int **creatArea2D(const unsigned int N); void screenDisplay( unsigned short int **tab,int size); -void inGameLoop (unsigned short int **tab2d, vect *playerPos, vect *targets, int nbr_targets); +void inGameLoop (unsigned short int **tab2d, int N, vect *playerPos, vect *targets, int nbr_targets); bool isWin(unsigned short int **tab2d, vect *targets, int nbr_targets); #endif // FONCTION_H diff --git a/main.c b/main.c index 4ab415b..2b3137b 100644 --- a/main.c +++ b/main.c @@ -1,17 +1,19 @@ #include #include "function.h" -#include "display.h" #include "read.h" +#include "display.h" + +#define SIZE_PLAY 24 int main() { vect *playerPos = (vect *)malloc(sizeof(vect)); vect *targets; int nbr_targets; - unsigned short int **tab2d = creatArea2D(32); - targets = fileToTab2D("test.txt", tab2d, 32, playerPos, &nbr_targets); - screenDisplay(tab2d, 32); - inGameLoop(tab2d,playerPos, targets, nbr_targets); + unsigned short int **tab2d = creatArea2D(SIZE_PLAY); + targets = fileToTab2D("test.txt", tab2d, SIZE_PLAY, playerPos, &nbr_targets); + screenDisplay(tab2d, SIZE_PLAY); + inGameLoop(tab2d, SIZE_PLAY, playerPos, targets, nbr_targets); free(playerPos); return 0; }