blob: 4db469a0a4c94a21b57906f0336e3f2adefd3020 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include <libft.h>
#include <cub3d.h>
#include <stdlib.h>
int
ft_get_sprite_tex(int fd, 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));
}
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);
return (0);
}
|