aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_heal_spawn.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-18 21:35:54 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-18 21:35:54 +0100
commitd114d2571a3808eba1f0a5038ad862b790a96074 (patch)
tree8d2d4c19a2a8de61a253dc0a4fc2434a770470a6 /src/ft_get_heal_spawn.c
parentMerge branch 'better_sprites' (diff)
download42-cub3d-d114d2571a3808eba1f0a5038ad862b790a96074.tar.gz
42-cub3d-d114d2571a3808eba1f0a5038ad862b790a96074.tar.bz2
42-cub3d-d114d2571a3808eba1f0a5038ad862b790a96074.tar.xz
42-cub3d-d114d2571a3808eba1f0a5038ad862b790a96074.tar.zst
42-cub3d-d114d2571a3808eba1f0a5038ad862b790a96074.zip
In progress
Diffstat (limited to 'src/ft_get_heal_spawn.c')
-rw-r--r--src/ft_get_heal_spawn.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/ft_get_heal_spawn.c b/src/ft_get_heal_spawn.c
new file mode 100644
index 0000000..142709b
--- /dev/null
+++ b/src/ft_get_heal_spawn.c
@@ -0,0 +1,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++;
+ }
+}