diff options
author | Rudy Bousset <rbousset@z2r4p3.le-101.fr> | 2020-02-05 20:34:42 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z2r4p3.le-101.fr> | 2020-02-05 20:34:42 +0100 |
commit | eb11f281970bfe7bbf17786089709d4e0016b8c7 (patch) | |
tree | 61e4dcb1a75c4272a71bcf0e2c49cb0968e176d6 /src | |
parent | Changed return values (diff) | |
download | 42-cub3d-eb11f281970bfe7bbf17786089709d4e0016b8c7.tar.gz 42-cub3d-eb11f281970bfe7bbf17786089709d4e0016b8c7.tar.bz2 42-cub3d-eb11f281970bfe7bbf17786089709d4e0016b8c7.tar.xz 42-cub3d-eb11f281970bfe7bbf17786089709d4e0016b8c7.tar.zst 42-cub3d-eb11f281970bfe7bbf17786089709d4e0016b8c7.zip |
Norme
Diffstat (limited to '')
-rw-r--r-- | src/ft_check_missing.c | 7 | ||||
-rw-r--r-- | src/ft_parse_map.c | 9 | ||||
-rw-r--r-- | src/ft_select_get.c | 14 | ||||
-rw-r--r-- | src/main.c | 2 |
4 files changed, 15 insertions, 17 deletions
diff --git a/src/ft_check_missing.c b/src/ft_check_missing.c index 00bfbe9..ece2ba6 100644 --- a/src/ft_check_missing.c +++ b/src/ft_check_missing.c @@ -27,7 +27,6 @@ int int ft_check_missing(t_cub *clist) { - ft_printf("[%d], [%d], [%d]\n", clist->f_rgb.r, clist->f_rgb.g, clist->f_rgb.b); if (!clist->no_tex_path[0]) return (ft_missing_error("north side texture", clist)); else if (!clist->so_tex_path[0]) @@ -40,9 +39,11 @@ int return (ft_missing_error("sprite texture", clist)); else if (clist->wlist->x_size == 0 || clist->wlist->y_size == 0) return (ft_missing_error("resolution", clist)); - else if (clist->f_rgb.r == -1 || clist->f_rgb.g == -1 || clist->f_rgb.b == -1) + else if (clist->f_rgb.r == -1 || clist->f_rgb.g == -1 + || clist->f_rgb.b == -1) return (ft_missing_error("floor color", clist)); - else if (clist->c_rgb.r == -1 || clist->c_rgb.g == -1 || clist->c_rgb.b == -1) + else if (clist->c_rgb.r == -1 || clist->c_rgb.g == -1 + || clist->c_rgb.b == -1) return (ft_missing_error("ceiling color", clist)); else if (clist->plist->pos_x == 0 || clist->plist->pos_y == 0) return (ft_missing_error("player spawn", clist)); diff --git a/src/ft_parse_map.c b/src/ft_parse_map.c index 9112b5b..85337f0 100644 --- a/src/ft_parse_map.c +++ b/src/ft_parse_map.c @@ -112,15 +112,14 @@ void ret = 1; while (ret != 12 && ret != -1) ret = ft_parse_it(fd, clist); - if (ret == -1) - ft_map_error(clist); + (ret == -1) ? (ft_map_error(clist)) : 0; if (ft_get_map_core(fd, clist) < 0) ft_map_error(clist); ft_check_map_last_line(clist); ft_get_player_spawn(clist->plist, clist); ft_check_missing(clist); - if ((clist->scale = ((uint16_t)clist->wlist->x_size / - (uint16_t)clist->map_w) - 1) < 1) - clist->scale = 1; + ft_print_list(clist); + ((clist->scale = ((uint16_t)clist->wlist->x_size / + (uint16_t)clist->map_w) - 1) < 1) ? (clist->scale = 1) : 0; close(fd); } diff --git a/src/ft_select_get.c b/src/ft_select_get.c index 53a37d4..76f424d 100644 --- a/src/ft_select_get.c +++ b/src/ft_select_get.c @@ -17,7 +17,7 @@ #include <stdint.h> static int8_t -ft_check_exists(const int8_t ret, t_cub *clist) + ft_check_exists(const int8_t ret, t_cub *clist) { if (ret == 12) return (12); @@ -33,12 +33,12 @@ ft_check_exists(const int8_t ret, t_cub *clist) return (-1); else if (ret == 5 && (clist->sprite_path[0])) return (-1); - /* else if (ret == 6 && ((clist->f_rgb.r != -1) || (clist->f_rgb.g != -1) */ - /* || (clist->f_rgb.b != -1))) */ - /* return (-1); */ - /* else if (ret == 7 && ((clist->c_rgb.r != -1) || (clist->c_rgb.g != -1) */ - /* || (clist->c_rgb.b != -1))) */ - /* return (-1); */ + else if (ret == 6 && ((clist->f_rgb.r != -1) || (clist->f_rgb.g != -1) + || (clist->f_rgb.b != -1))) + return (-1); + else if (ret == 7 && ((clist->c_rgb.r != -1) || (clist->c_rgb.g != -1) + || (clist->c_rgb.b != -1))) + return (-1); return (ret); } @@ -20,7 +20,6 @@ int main(int argc, const char *argv[]) { t_cub *clist; - (void)argv; if (argc < 2) { @@ -38,7 +37,6 @@ int ft_memdel((void**)&clist); return (2); } - ft_print_list(clist); ft_parse_map(argv[1], clist); if (ft_init_winlx(clist) < 0) return (ft_exit(3, clist)); |