createur de map fini

This commit is contained in:
cyjullien1
2025-01-06 16:05:47 +01:00
parent 46dc1a800a
commit 13fd66cecb
7 changed files with 52 additions and 40 deletions

View File

@@ -31,6 +31,7 @@ int main ()
char **tab2d = creatArea2D (SIZE_PLAY, SIZE_PLAY);
score score_user = {0, 0, 0,0};
int num_fichier=0;
vect dim = {SIZE_PLAY, SIZE_PLAY};
int output = -1;
@@ -63,7 +64,7 @@ int main ()
{
printf("editeur de map");
//newmap
output = inEditorLoop(tab2d, &dim, playerPos, targets, nbr_targets, &display_user, &score_user);
output = inEditorLoop(tab2d, &dim, playerPos, targets, nbr_targets, &display_user,&score_user ,num_fichier);
}
else
{
@@ -93,16 +94,17 @@ int main ()
else{
char path[256];
snprintf(path, sizeof(path), "maps/custom_%d.txt", output-4);
num_fichier = output-4;
FILE *src = fopen("maps/viergemap.txt", "r");
FILE *file = fopen(path, "w");
char buffer[1024]; // Tampon pour lire le contenu
char tmp[1024]; // Tampon pour lire le contenu
size_t bytesRead;
// Lire le contenu du fichier source et l'écrire dans le fichier destination
while ((bytesRead = fread(buffer, 1, sizeof(buffer), src)) > 0) {
fwrite(buffer, 1, bytesRead, file);
while ((bytesRead = fread(tmp, 1, sizeof(tmp), src)) > 0) {
fwrite(tmp, 1, bytesRead, file);
}
fclose(src);