aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_sprite_spawns.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-16 19:05:52 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-16 19:05:52 +0100
commit192f2260f196914e0db07d4695dc85a859f24e26 (patch)
tree58f343a5dd6161da601bf8ccae05acc0782c2e9b /src/ft_get_sprite_spawns.c
parentin progress (diff)
download42-cub3d-192f2260f196914e0db07d4695dc85a859f24e26.tar.gz
42-cub3d-192f2260f196914e0db07d4695dc85a859f24e26.tar.bz2
42-cub3d-192f2260f196914e0db07d4695dc85a859f24e26.tar.xz
42-cub3d-192f2260f196914e0db07d4695dc85a859f24e26.tar.zst
42-cub3d-192f2260f196914e0db07d4695dc85a859f24e26.zip
Still searching
Diffstat (limited to 'src/ft_get_sprite_spawns.c')
-rw-r--r--src/ft_get_sprite_spawns.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ft_get_sprite_spawns.c b/src/ft_get_sprite_spawns.c
index 3a44f56..da883b2 100644
--- a/src/ft_get_sprite_spawns.c
+++ b/src/ft_get_sprite_spawns.c
@@ -19,7 +19,7 @@ void
ft_get_next_sprite(t_cub *clist, int s_n, char c, size_t x)
{
size_t y;
- uint8_t i;
+ int16_t i;
y = 0;
i = 0;
@@ -37,7 +37,8 @@ void
}
x = 0;
}
- if (clist->sprites[s_n][i - 1].s_pos_x != 0)
+ if (clist->sprites[s_n][(i - 1 < 0) ? (0) : (i - 1)].s_pos_x != 0
+ && s_n + 1 < 7)
{
ft_get_next_sprite(clist, s_n + 1, c + 1, 0);
}