diff options
author | Rudy Bousset <rbousset@z2r5p6.le-101.fr> | 2020-02-02 18:37:10 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z2r5p6.le-101.fr> | 2020-02-02 18:37:10 +0100 |
commit | 88c8592fa835c7c5a010f69e80e09a8e38caa09f (patch) | |
tree | f2371c512957931e6446a9bedacc79ac815e7e6f /src/ft_init_lists.c | |
parent | Changed variable name (diff) | |
download | 42-cub3d-88c8592fa835c7c5a010f69e80e09a8e38caa09f.tar.gz 42-cub3d-88c8592fa835c7c5a010f69e80e09a8e38caa09f.tar.bz2 42-cub3d-88c8592fa835c7c5a010f69e80e09a8e38caa09f.tar.xz 42-cub3d-88c8592fa835c7c5a010f69e80e09a8e38caa09f.tar.zst 42-cub3d-88c8592fa835c7c5a010f69e80e09a8e38caa09f.zip |
Added player list
Diffstat (limited to 'src/ft_init_lists.c')
-rw-r--r-- | src/ft_init_lists.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/ft_init_lists.c b/src/ft_init_lists.c index f81e256..b7602ab 100644 --- a/src/ft_init_lists.c +++ b/src/ft_init_lists.c @@ -17,6 +17,18 @@ #include <stddef.h> #include <stdlib.h> +t_player + *ft_init_player(void) +{ + t_player *plist; + + if (!(plist = (t_player*)malloc(sizeof(t_player)))) + return (NULL); + plist->pos_x = 0; + plist->pos_y = 0; + return (plist); +} + t_win *ft_init_win(void) { @@ -36,7 +48,7 @@ t_win t_cub *ft_init_cub(void) { - t_cub *clist; + t_cub *clist; if (!(clist = (t_cub*)malloc(sizeof(t_cub)))) return (NULL); @@ -47,7 +59,8 @@ t_cub !(clist->sprite_path = (char*)ft_calloc(1, sizeof(char))) || !(clist->mapl = (char*)ft_calloc(1, sizeof(char))) || !(clist->map = (char**)ft_calloc(2, sizeof(char*))) || - !(clist->map[0] = (char*)ft_calloc(1, sizeof(char)))) + !(clist->map[0] = (char*)ft_calloc(1, sizeof(char))) || + !(clist->plist = ft_init_player())) return (NULL); clist->map[1] = 0; clist->f_color = -1; |