Correction de bug
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.
This commit is contained in:
parent
8fe62b8b47
commit
81a4cb1cf9
@ -1,5 +1,6 @@
|
|||||||
#include<stdio.h>
|
#include<stdio.h>
|
||||||
#include<stdlib.h>
|
#include<stdlib.h>
|
||||||
|
#include<string.h>
|
||||||
#include<graph.h>
|
#include<graph.h>
|
||||||
#include"../include/main.h"
|
#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) {
|
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};
|
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);
|
DessinerRectangle(carte.zone.x, carte.zone.y, carte.zone.L, carte.zone.H);
|
||||||
return carte;
|
return carte;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user