aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_heal_spawn.c
blob: 142709bdaa54a5ae5752db110b9ac2a642f11603 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_get_traps.c                                     :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: rbousset <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/28 18:24:52 by rbousset          #+#    #+#             */
/*   Updated: 2020/02/28 18:24:56 by rbousset         ###   ########lyon.fr   */
/*                                                                            */
/* ************************************************************************** */

#include <libft.h>
#include <cub3d.h>
#include <stdint.h>

void
	ft_get_heal_spawn(t_cub *clist)
{
	size_t	x;
	size_t	y;
	uint8_t i;

	x = 1;
	y = 1;
	i = 0;
	while (clist->mlist.map[y])
	{
		while (clist->mlist.map[y][x])
		{
			if (clist->mlist.map[y][x] == '+')
			{
				clist->mlist.heals_nbr++;
				if (clist->mlist.heals_nbr > 64)
					ft_map_error(FT_ERR_TOO_MUCH_HEALS, clist);
				clist->heals[i].s_pos_x = x;
				clist->heals[i].s_pos_y = y;
				i++;
			}
			x++;
		}
		x = 1;
		y++;
	}
}