aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_sprite_spawns.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-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);
}