improved set_textures function

This commit is contained in:
Theo Champion 2025-06-08 20:29:35 +02:00
parent 1d16d66d89
commit d336d7bc15

View file

@ -6,7 +6,7 @@
/* By: tchampio <tchampio@student.42lehavre. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/06/06 17:54:42 by tchampio #+# #+# */
/* Updated: 2025/06/06 17:55:56 by tchampio ### ########.fr */
/* Updated: 2025/06/08 20:28:57 by tchampio ### ########.fr */
/* */
/* ************************************************************************** */
@ -64,12 +64,16 @@ bool set_textures(char *line, t_mapdata *map)
bool add_textures(int fd, t_mapdata *map)
{
char *line;
int set_lines;
line = get_next_line(fd);
while (line)
set_lines = 0;
while (line && set_lines < 4)
{
if (!set_textures(line, map))
return (free(line), false);
else
set_lines++;
free(line);
line = get_next_line(fd);
}