From 81a4cb1cf9a2cfd28a13c7aec78b73647b9ac295 Mon Sep 17 00:00:00 2001 From: Lyanis Souidi Date: Sun, 4 Dec 2022 11:51:48 +0100 Subject: [PATCH] Correction de bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Les variables file des structures card pointaient toutes vers la variable file de la fonction game(), les images affichées à l'écran étaient donc toutes les mêmes. --- src/card.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/card.c b/src/card.c index 6a1f8f3..9ce36b7 100644 --- a/src/card.c +++ b/src/card.c @@ -1,5 +1,6 @@ #include #include +#include #include #include"../include/main.h" @@ -27,8 +28,10 @@ card show_card(card carte) { } card create_card(int x, int y, int L, int H, int id, char *file) { + char *filename = (char*)malloc(30 * sizeof(char)); + memcpy(filename, file, 30); zone zone = {x, y, L, H}; - card carte = {zone, 0, 0, 0, id, file}; + card carte = {zone, 0, 0, 0, id, filename}; DessinerRectangle(carte.zone.x, carte.zone.y, carte.zone.L, carte.zone.H); return carte; } \ No newline at end of file