From c1f91998d9cf530d86b6e8d2ddfecf06cae43664 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 28 Jan 2020 16:32:37 +0100 Subject: Got sprite --- src/ft_get_sprite.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) (limited to 'src/ft_get_sprite.c') diff --git a/src/ft_get_sprite.c b/src/ft_get_sprite.c index 568e513..f1fa73f 100644 --- a/src/ft_get_sprite.c +++ b/src/ft_get_sprite.c @@ -1,29 +1,14 @@ #include #include -#include int -ft_get_sprite(int fd, t_cub *clist) +ft_get_sprite(char **words, t_cub *clist) { - char *line; - char **words; - - if (get_next_line(fd, &line) <= 0 || !(words = ft_split(line, ' '))) - { - ft_memdel(line); - return (ft_map_error(7, clist)); - } - if (!(*words) || ft_strcmp(*words, "S") || !words[1] || words[2]) - { - ft_free_words(words, line); - return (ft_map_error(7, clist)); - } + if (!(*words) || !words[1] || words[2]) + return (-1); ft_memdel(clist->sprite_path); if (!(clist->sprite_path = ft_strdup(*(words + 1)))) - { - ft_free_words(words, line); return (-1); - } - ft_free_words(words, line); + ft_printf("{%s}\n", clist->sprite_path); return (0); } -- cgit v1.2.3