aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_init_lists.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ft_init_lists.c17
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;