/* ************************************************************************** */ /* LE - / */ /* / */ /* ft_get_player_spawn.c .:: .:/ . .:: */ /* +:+:+ +: +: +:+:+ */ /* By: rbousset +:+ +: +: +:+ */ /* #+# #+ #+ #+# */ /* Created: 2020/02/02 19:07:18 by rbousset #+# ## ## #+# */ /* Updated: 2020/02/02 19:07:19 by rbousset ### #+. /#+ ###.fr */ /* / */ /* / */ /* ************************************************************************** */ #include #include #include static uint8_t ft_get_view_side(char c) { if (c == 'N') return (1); else if (c == 'E') return (2); else if (c == 'S') return (3); else if (c == 'W') return (4); return (1); } void ft_get_player_spawn(t_player *plist, t_cub *clist) { size_t x; size_t y; x = 1; y = 1; while (clist->map[y]) { while (clist->map[y][x]) { if (ft_ischarset("NSEW", clist->map[y][x])) { plist->pos_x = x; plist->pos_y = y; plist->view_side = ft_get_view_side(clist->map[y][x]); return ; } x++; } x = 1; y++; } }