diff --git a/mandatory/key.c b/mandatory/key.c index 89c32f1..0d01981 100644 --- a/mandatory/key.c +++ b/mandatory/key.c @@ -12,10 +12,11 @@ #include "solong.h" -static void ft_case_update(char *new_pos, char *player_pos) +static void ft_case_update(t_data *data, char *new_pos, char *player_pos) { *new_pos = 'P'; *player_pos = '0'; + ft_printf("\r%d", ++data->nb_foots); } static void ft_move(t_data *data, char direction) @@ -36,7 +37,8 @@ static void ft_move(t_data *data, char direction) if (*new_pos == 'C') data->map->nb_collectable--; if (*new_pos == '0' || *new_pos == 'C') - ft_case_update(new_pos, &data->map->patern[tab[1]][tab[0]]); + ft_case_update(data, new_pos, + &data->map->patern[tab[1]][tab[0]]); if (*new_pos == 'E') { if (data->map->nb_collectable == 0) diff --git a/mandatory/main.c b/mandatory/main.c index 408c66f..54140ce 100644 --- a/mandatory/main.c +++ b/mandatory/main.c @@ -76,6 +76,7 @@ int main(int ac, char **av) } data.map = NULL; data.window = NULL; + data.nb_foots = 0; if (ft_initialised(av[1], &data)) ft_printf("Memory error"); return (1); diff --git a/mandatory/solong.h b/mandatory/solong.h index e40b62c..08fef62 100644 --- a/mandatory/solong.h +++ b/mandatory/solong.h @@ -44,10 +44,10 @@ typedef struct s_data void *mlx; void *window; void *assets[NB_COLORS + 1]; + size_t nb_foots; t_map *map; } t_data; -//void ft_ultimate_image_destroyer(t_data *data); int ft_test_map_is_finishable(t_map *map); int ft_exit(t_data *data); int ft_test_map_content2(char **patern);