diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-01-28 16:01:25 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-01-28 16:01:25 +0100 |
commit | 1b3cf4e3ce43e556ef47c669511620815b747221 (patch) | |
tree | be53e93d6fd39578ce71e82502c1289aac98e819 /src/ft_select_get.c | |
parent | Everything is terrible but this might work (diff) | |
download | 42-cub3d-1b3cf4e3ce43e556ef47c669511620815b747221.tar.gz 42-cub3d-1b3cf4e3ce43e556ef47c669511620815b747221.tar.bz2 42-cub3d-1b3cf4e3ce43e556ef47c669511620815b747221.tar.xz 42-cub3d-1b3cf4e3ce43e556ef47c669511620815b747221.tar.zst 42-cub3d-1b3cf4e3ce43e556ef47c669511620815b747221.zip |
I understood
Diffstat (limited to '')
-rw-r--r-- | src/ft_select_get.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/ft_select_get.c b/src/ft_select_get.c index 0ddc80a..e6cdfd8 100644 --- a/src/ft_select_get.c +++ b/src/ft_select_get.c @@ -1,7 +1,29 @@ +#include <libft.h> +#include <cub3d.h> +#include <stdint.h> + +static uint8_t +ft_get_id(char **words) +{ + if (!ft_strcmp(words[0], "R")) + return (0); + if (!ft_strcmp(words[0], "NO")) + return (1); + return (12); +} + int ft_select_get(char **words, t_cub *clist) { - (void)words; - (void)clist; + int (*fun_ptr[4])(char**, t_cub*); + uint8_t id; + + fun_ptr[0] = ft_get_res; + fun_ptr[1] = + if ((*fun_ptr[ft_get_id(words)])(words, clist) < 0) + { + ft_free_words(words); + return (ft_map_error(clist)); + } return (0); } |