fuite de memoire et print retirer

This commit is contained in:
2024-12-30 11:30:26 +01:00
parent 0e0b1a2528
commit 18399f735c
3 changed files with 2 additions and 13 deletions

View File

@@ -354,13 +354,11 @@ int inGameLoop (char **tab2d, vect *dim_tab, vect *playerPos, vect *targets,
size_menu, 50); size_menu, 50);
if (isWin (tab2d, targets, nbr_targets)) if (isWin (tab2d, targets, nbr_targets))
{ {
puts ("Win!");
return 1; return 1;
finish = true; finish = true;
} }
if (islose (tab2d, dim_tab->x)) if (islose (tab2d, dim_tab->x))
{ {
puts ("lose!");
return 0; return 0;
finish = true; finish = true;
} }
@@ -589,24 +587,19 @@ bool blockBox (char **tab2d, vect box_coor)
while (!wall) while (!wall)
{ {
char val = tab2d[current.x][current.y]; char val = tab2d[current.x][current.y];
printf("val : %d ", val);
vect cur_nor = plusVect (current, normal); vect cur_nor = plusVect (current, normal);
char val_nor = tab2d[cur_nor.x][cur_nor.y]; char val_nor = tab2d[cur_nor.x][cur_nor.y];
printf("val_nor : %d\n", val_nor);
if (val == WALL) if (val == WALL)
wall = true; wall = true;
else if (val == TARGET) else if (val == TARGET)
return false; return false;
if (val_nor != WALL) if (val_nor != WALL)
{ {
printf("coor (%d, %d), val_nor : %d\n", box_coor.x, box_coor.y, val_nor);
return false; return false;
} }
current = plusVect(current, dir_test[i]); current = plusVect(current, dir_test[i]);
} }
} }
printf("coor (%d, %d)\n", box_coor.x, box_coor.y);
return true; return true;
} }
@@ -645,8 +638,6 @@ void nullScore(score *player_score)
*/ */
void winOrLoseLoop(dis *display_user, bool win) void winOrLoseLoop(dis *display_user, bool win)
{ {
puts("dedans");
printf("%b \n", win);
SDL_Surface *img; SDL_Surface *img;
SDL_Texture *texture; SDL_Texture *texture;
@@ -654,7 +645,6 @@ void winOrLoseLoop(dis *display_user, bool win)
else img = IMG_Load("image/lose.png"); else img = IMG_Load("image/lose.png");
texture = SDL_CreateTextureFromSurface (display_user->renderer, img); texture = SDL_CreateTextureFromSurface (display_user->renderer, img);
printf("text : %p", texture);
vect pos = {0, 0}; vect pos = {0, 0};
displayImage(display_user->renderer, texture, pos, display_user->size_window); displayImage(display_user->renderer, texture, pos, display_user->size_window);
@@ -669,7 +659,8 @@ void winOrLoseLoop(dis *display_user, bool win)
if(event.type == SDL_KEYDOWN && event.key.keysym.scancode == SDL_SCANCODE_RETURN) finish = true; if(event.type == SDL_KEYDOWN && event.key.keysym.scancode == SDL_SCANCODE_RETURN) finish = true;
SDL_Delay(16); SDL_Delay(16);
} }
puts("fini");
SDL_FreeSurface (img);
SDL_DestroyTexture (texture);
return; return;
} }

View File

@@ -39,7 +39,6 @@ int main ()
vect null = {0, 0}; vect null = {0, 0};
printf("output : %d\n", output);
output = inGameLoop (menu, &dim_menu, &pos, &null , 1, output = inGameLoop (menu, &dim_menu, &pos, &null , 1,
&display_user, &score_user, true); &display_user, &score_user, true);
nullScore(&score_user); nullScore(&score_user);

View File

@@ -80,7 +80,6 @@ int countCustomMaps(char *name_directory)
{ {
nbr++; nbr++;
sprintf(name_map, "%s/custom_%d.txt",name_directory ,nbr); sprintf(name_map, "%s/custom_%d.txt",name_directory ,nbr);
printf("%p, %d, %s\n", file, nbr, name_map);
file = fopen(name_map, "r"); file = fopen(name_map, "r");
} }