diff options
Diffstat (limited to '')
-rw-r--r-- | src/ft_select_get.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/ft_select_get.c b/src/ft_select_get.c index 7b1b524..d44fa88 100644 --- a/src/ft_select_get.c +++ b/src/ft_select_get.c @@ -5,17 +5,17 @@ static uint8_t ft_get_id(char **words) { - if (!ft_strcmp(words[0], "R")) + if (!ft_strncmp(words[0], "R", 1)) return (0); - if (!ft_strcmp(words[0], "NO")) + if (!ft_strncmp(words[0], "NO", 2)) return (1); - if (!ft_strcmp(words[0], "SO")) + if (!ft_strncmp(words[0], "SO", 2)) return (2); - if (!ft_strcmp(words[0], "EA")) + if (!ft_strncmp(words[0], "EA", 2)) return (3); - if (!ft_strcmp(words[0], "WE")) + if (!ft_strncmp(words[0], "WE", 2)) return (4); - if (!ft_strcmp(words[0], "S")) + if (!ft_strncmp(words[0], "S", 1)) return (5); return (12); } @@ -23,7 +23,7 @@ ft_get_id(char **words) uint8_t ft_select_get(char **words, t_cub *clist) { - int (*fun_ptr[6])(char**, t_cub*); + int (*fun_ptr[7])(char**, t_cub*); uint8_t id; fun_ptr[0] = ft_get_res; @@ -32,6 +32,7 @@ ft_select_get(char **words, t_cub *clist) fun_ptr[3] = ft_get_tex_ea; fun_ptr[4] = ft_get_tex_we; fun_ptr[5] = ft_get_sprite; + fun_ptr[6] = ft_get_colors; if ((id = ft_get_id(words)) == 12) { ft_free_words(words); @@ -42,5 +43,6 @@ ft_select_get(char **words, t_cub *clist) ft_free_words(words); return (ft_map_error(clist)); } + ft_free_words(words); return (id); } |