![]() |
tgrekov-fdf
HIVE fdf May 2024
|
Definition in file read_map.c.
#include <stdlib.h>#include <stdio.h>#include <errno.h>#include <libft.h>#include <ft_printf.h>#include <get_next_line_bonus.h>#include "utils/utils.h"#include "fdf/map.h"Go to the source code of this file.
Functions | |
| static void | lst_arr_free (void *arr) |
| Wrapper around arr_free for use with ft_lstclear. | |
| static char * | prep_row (char *row, t_list **lst) |
| Remove trailing newline from row or print appropriate error message. | |
| static void | split_rows (int fd, t_list **lst) |
Read rows from fd and place them into lst nodes, split on spaces. | |
| static int | fill_points (t_map *map, t_list *lst) |
Allocate map points and set height values from lst. | |
| t_map | read_map (int fd) |
Initialize map from an fdf map file pointed to by fd. | |
Allocate map points and set height values from lst.
| [in,out] | map | |
| [in] | lst |
| int | 0 on success, positive number greater than zero otherwise |
Definition at line 112 of file read_map.c.
References arr_free(), arr_len(), s_list::content, err(), ft_atoi(), ft_printf(), s_point::height, s_list::next, s_map::point, and s_map::width.
|
static |
Wrapper around arr_free for use with ft_lstclear.
| arr |
Definition at line 35 of file read_map.c.
References arr_free().
|
static |
Remove trailing newline from row or print appropriate error message.
| [in] | row | |
| [in] | lst | Linked list where each node contains an array of strings with height,color for that index of the row |
| char* |
Definition at line 48 of file read_map.c.
References ft_printf(), and ft_strlen().
| t_map read_map | ( | int | fd | ) |
Initialize map from an fdf map file pointed to by fd.
| [in] | fd |
| t_map |
Definition at line 147 of file read_map.c.
References arr_len(), s_list::content, err(), fill_points(), ft_calloc(), ft_lstclear(), ft_lstsize(), s_map::height, lst_arr_free(), s_map::point, split_rows(), and s_map::width.
|
static |
Read rows from fd and place them into lst nodes, split on spaces.
| [in] | fd | Map file fd |
| [out] | lst | Linked list where each node contains an array of strings with height,color for that index of the row |
Definition at line 76 of file read_map.c.
References ft_lstadd_back(), ft_lstclear(), ft_lstnew(), ft_split(), get_next_line(), lst_arr_free(), and prep_row().