21static void set_position_and_direction(
24 player->view_point.x = grid.x + 0.5;
25 player->view_point.y = grid.y + 0.5;
26 set_direction(direction, player);
32static bool is_player_position(
char map_point)
34 return (map_point ==
'N' || map_point ==
'S'
35 || map_point ==
'W' || map_point ==
'E');
38bool is_valid_char(
char map_point)
40 return (map_point ==
'1' || map_point ==
'0' || map_point ==
' ');
43int find_player_and_set(
46 if (is_player_position(data[grid.y][grid.x]) ==
true)
48 if ((parse->flag & BIT_PLAYER) > 0x00)
51 ERR_PROMPT, EMSG_MAP_PLAYER_MULTI);
52 return (EXIT_FAILURE);
54 parse->flag |= BIT_PLAYER;
55 parse->player_grid = grid;
56 set_position_and_direction(player, grid, data[grid.y][grid.x]);
57 data[grid.y][grid.x] =
'0';
61 if (is_valid_char(data[grid.y][grid.x]) !=
true)
63 ft_eprintf(
"%s%s", ERR_PROMPT, EMSG_MAP_CHAR);
64 ft_eprintf(
": \"%c\"\n", data[grid.y][grid.x]);
65 return (EXIT_FAILURE);
68 return (EXIT_SUCCESS);