aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_tex.c
blob: 1965e720aca4d4e3e23a371d09e31abc1c8089b9 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_get_tex.c                                       :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: rbousset <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/14 17:28:52 by rbousset          #+#    #+#             */
/*   Updated: 2020/02/14 17:28:52 by rbousset         ###   ########lyon.fr   */
/*                                                                            */
/* ************************************************************************** */

#include <libft.h>
#include <cub3d.h>
#include <stdlib.h>

int8_t
	ft_get_tex_no(char **words, t_cub *clist)
{
	if (!(*words) || !(*(words + 1)) || (*(words + 2)))
		return (-1);
	ft_memdel((void**)&clist->mlist->no_tex_path);
	if (!(clist->mlist->no_tex_path = ft_strdup(*(words + 1))))
		return (-1);
	return (0);
}

int8_t
	ft_get_tex_so(char **words, t_cub *clist)
{
	if (!(*words) || !(*(words + 1)) || (*(words + 2)))
		return (-1);
	ft_memdel((void**)&clist->mlist->so_tex_path);
	if (!(clist->mlist->so_tex_path = ft_strdup(*(words + 1))))
		return (-1);
	return (0);
}

int8_t
	ft_get_tex_ea(char **words, t_cub *clist)
{
	if (!(*words) || !(*(words + 1)) || (*(words + 2)))
		return (-1);
	ft_memdel((void**)&clist->mlist->ea_tex_path);
	if (!(clist->mlist->ea_tex_path = ft_strdup(*(words + 1))))
		return (-1);
	return (0);
}

int8_t
	ft_get_tex_we(char **words, t_cub *clist)
{
	if (!(*words) || !(*(words + 1)) || (*(words + 2)))
		return (-1);
	ft_memdel((void**)&clist->mlist->we_tex_path);
	if (!(clist->mlist->we_tex_path = ft_strdup(*(words + 1))))
		return (-1);
	return (0);
}