From 1363bda556bf08657bf19ff79e93319c17c22fc1 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sun, 22 Mar 2020 15:38:28 +0100 Subject: More norm --- Makefile | 1 + inc/cub3d.h | 1 + src/ft_get_player_spawn.c | 5 ----- src/ft_get_spawns.c | 26 ++++++++++++++++++++++++++ src/ft_get_sprite_spawns.c | 1 - src/ft_hooks_and_loops.c | 2 +- src/ft_parse_map.c | 4 ++-- 7 files changed, 31 insertions(+), 9 deletions(-) create mode 100644 src/ft_get_spawns.c diff --git a/Makefile b/Makefile index f40452f..dec560a 100644 --- a/Makefile +++ b/Makefile @@ -119,6 +119,7 @@ SRCS_NAME += ft_check_missing_sfx.c SRCS_NAME += ft_del_tex.c SRCS_NAME += ft_del_map.c SRCS_NAME += ft_del_lists.c +SRCS_NAME += ft_get_spawns.c #--------------------------------------------------------------------------------------------------# SRCS = $(addprefix ${SRCS_DIR},${SRCS_NAME}) #--------------------------------------------------------------------------------------------------# diff --git a/inc/cub3d.h b/inc/cub3d.h index b8b6681..853eb5b 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -140,6 +140,7 @@ int ft_check_missing_sfx(t_cub *clist); int ft_missing_error(const char *err, t_cub *clist); int ft_map_error(const char *errmsg, t_cub *clist); size_t ft_get_line_len(char *line); +void ft_get_spawns(t_cub *cl); /* ** ====== ARGS ====== diff --git a/src/ft_get_player_spawn.c b/src/ft_get_player_spawn.c index 0d9018a..c506775 100644 --- a/src/ft_get_player_spawn.c +++ b/src/ft_get_player_spawn.c @@ -82,11 +82,6 @@ void plist->start_x = plist->pos_x; plist->start_y = plist->pos_y; ft_get_start_side(clist->mlist.map[y][x], plist); - ft_get_sprite_spawn(clist); - ft_get_trap_spawn(clist); - ft_get_heal_spawn(clist); - if (clist->isdead == 0) - ft_get_weapon_spawn(clist); return ; } x++; diff --git a/src/ft_get_spawns.c b/src/ft_get_spawns.c new file mode 100644 index 0000000..6422785 --- /dev/null +++ b/src/ft_get_spawns.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_get_sprite_spawns.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:51 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:51 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include + +void + ft_get_spawns(t_cub *cl) +{ + ft_get_player_spawn(&cl->plist, cl); + ft_get_sprite_spawn(cl); + ft_get_trap_spawn(cl); + ft_get_heal_spawn(cl); + if (cl->isdead == 0) + ft_get_weapon_spawn(cl); +} diff --git a/src/ft_get_sprite_spawns.c b/src/ft_get_sprite_spawns.c index d7b6677..c24ba85 100644 --- a/src/ft_get_sprite_spawns.c +++ b/src/ft_get_sprite_spawns.c @@ -13,7 +13,6 @@ #include #include #include -#include void ft_get_next_sprite(t_cub *clist, int s_n, char c, size_t x) diff --git a/src/ft_hooks_and_loops.c b/src/ft_hooks_and_loops.c index 9293496..b8bdd36 100644 --- a/src/ft_hooks_and_loops.c +++ b/src/ft_hooks_and_loops.c @@ -15,7 +15,7 @@ #include void -ft_hooks_and_loops(t_win *wl, t_cub *cl) + ft_hooks_and_loops(t_win *wl, t_cub *cl) { mlx_hook(wl->winptr, 2, (1L << 0), ft_key_event, cl); mlx_hook(wl->winptr, 3, (1L << 1), ft_key_release, cl); diff --git a/src/ft_parse_map.c b/src/ft_parse_map.c index 057b053..46fe022 100644 --- a/src/ft_parse_map.c +++ b/src/ft_parse_map.c @@ -74,7 +74,7 @@ static int8_t return (ret); } -void +static void ft_save_name(const char *map_path, t_cub *clist) { ft_memdel((void*)&clist->mlist.filename); @@ -105,7 +105,7 @@ void ft_map_error(clist->errmsg, clist); ft_check_map_last_line(clist); ft_check_map_surrounds(&clist->mlist, clist); - ft_get_player_spawn(&clist->plist, clist); + ft_get_spawns(clist); ft_get_nlvl_pos(&clist->mlist); ft_check_missing(clist); ft_set_minimap_scale(clist); -- cgit v1.2.3