Make it work with map20x40

This commit is contained in:
Andrei Pago 2023-04-05 18:00:46 +02:00
parent 39c4fb3158
commit d76384446b
5 changed files with 20 additions and 27 deletions

View File

@ -3,10 +3,10 @@
/* ::: :::::::: */
/* printing.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
/* By: apago <apago@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/05 04:11:08 by tischmid #+# #+# */
/* Updated: 2023/04/05 11:01:41 by tischmid ### ########.fr */
/* Updated: 2023/04/05 17:50:16 by apago ### ########.fr */
/* */
/* ************************************************************************** */
@ -22,7 +22,7 @@
void ft_putchar(char c, int fd);
void ft_putstr(char *str, int fd);
void ft_putnbr(int nb);
int ft_putnbr(int nb);
void print_map(t_map *map, int as_numbers);
int ft_err(char *str, int exit_code);

View File

@ -6,7 +6,7 @@
/* By: apago <apago@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/04 21:50:50 by tischmid #+# #+# */
/* Updated: 2023/04/05 17:41:33 by apago ### ########.fr */
/* Updated: 2023/04/05 18:00:14 by apago ### ########.fr */
/* */
/* ************************************************************************** */
@ -19,7 +19,7 @@ int main(void)
{
t_map map;
if (!read_fname("./assets/subject.map", &map))
if (!read_fname("./assets/map20x40.map", &map))
return (ft_err("map error\n", 1));
solve(&map);
print_map(&map, 0);

View File

@ -6,7 +6,7 @@
/* By: apago <apago@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/04 16:19:27 by apago #+# #+# */
/* Updated: 2023/04/05 17:39:56 by apago ### ########.fr */
/* Updated: 2023/04/05 17:59:32 by apago ### ########.fr */
/* */
/* ************************************************************************** */
@ -45,10 +45,8 @@ size_t parse_line(char *line, char *dst, t_meta *meta)
{
if (!line[i])
return (0);
if (line[i] == meta->empty)
dst[i] = '.';
else if (line[i] == meta->obstacle)
dst[i] = 'o';
if (line[i] == meta->empty || line[i] == meta->obstacle)
dst[i] = line[i];
else
return (0);
i++;

View File

@ -6,7 +6,7 @@
/* By: apago <apago@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/05 04:09:39 by tischmid #+# #+# */
/* Updated: 2023/04/05 17:28:54 by apago ### ########.fr */
/* Updated: 2023/04/05 17:48:29 by apago ### ########.fr */
/* */
/* ************************************************************************** */
@ -31,25 +31,20 @@ void ft_putstr(char *str, int fd)
ft_putchar(*str++, fd);
}
void ft_putnbr(int nb)
int ft_putnbr(int nb)
{
if (nb > 9)
{
ft_putnbr(nb / 10);
ft_putchar(nb % 10 + '0', 1);
}
else if (nb == INT_MIN)
{
ft_putnbr(nb / 10);
ft_putnbr(-(nb % 10));
}
else if (nb < 0)
int n;
if (nb < 0)
{
ft_putchar('-', 1);
ft_putnbr(-nb);
return (ft_putnbr(-nb) + 1);
}
else
ft_putchar(nb % 10 + '0', 1);
n = 1;
if (nb > 9)
n += ft_putnbr(nb / 10);
ft_putchar(nb % 10 + '0', 1);
return (n);
}
void print_map(t_map *map, int as_numbers)

View File

@ -6,7 +6,7 @@
/* By: apago <apago@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/04 21:46:57 by tischmid #+# #+# */
/* Updated: 2023/04/05 17:38:37 by apago ### ########.fr */
/* Updated: 2023/04/05 17:59:44 by apago ### ########.fr */
/* */
/* ************************************************************************** */