mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
fix: Added a check for the sprites, to avoid segfaults and/or invalid writes
This commit is contained in:
parent
94075506f6
commit
4a70e44697
1 changed files with 6 additions and 3 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/31 13:43:05 by kcolin #+# #+# */
|
||||
/* Updated: 2025/08/12 16:13:50 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/08/14 21:26:14 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -69,8 +69,11 @@ void place_base_sprites(t_cub3d_data *data, char **map)
|
|||
{
|
||||
if (map[y][x] == 'M' || map[y][x] == 'Q'
|
||||
|| map[y][x] == 'J' || map[y][x] == 'D')
|
||||
{
|
||||
if (c < MAX_SPRITES)
|
||||
data->sprite_list[c++] = place_right_sprite(data,
|
||||
map[y][x], x, y);
|
||||
}
|
||||
x++;
|
||||
}
|
||||
y++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue