t_wolf *init_map(char *av) { t_wolf *wolf; t_bunny_ini_scope *scope; t_bunny_ini *ini; if ((wolf = bunny_malloc(sizeof(t_wolf))) == NULL) return ((t_wolf *)-1); if ((ini = bunny_load_ini(av)) == NULL) return ((t_wolf *)-1); scope = bunny_ini_first(ini); scope = bunny_ini_next(ini, scope); wolf->s_name = bunny_ini_scope_name(ini, scope); wolf->width = 0; wolf->height = 0; wolf = get_dim(wolf, ini); if (check_air(wolf, ini) == -1) return ((t_wolf *)-1); wolf = get_map(wolf, ini); wolf = get_player(wolf, ini); if (init_error(wolf) == -1) return ((t_wolf *)-1); bunny_delete_ini(ini); return (wolf); }
void free_sampler(t_data *data) { int i; i = 0; while (i < NB_SAMPLES) { bunny_free(data->samples[i]->pitch); bunny_free(data->samples[i]->duration); bunny_delete_ini(data->samples[i]->ini); bunny_delete_sound(&data->samples[i]->music->sound); i += 1; } }
void clean(t_data *data) { int curs; curs = 0; bunny_delete_ini(data->ini); bunny_delete_sound(&data->music->sound); bunny_delete_sound(&data->sound->sound); bunny_delete_sound(&data->bad->sound); bunny_free(data->map->spawn); while (curs != data->map->height) { bunny_free(data->map->data[curs]); curs++; } bunny_free(data->map); bunny_free(data->pl); }