fix: prevent crash due to out-of-bounds when game lags

This commit is contained in:
Khaïs COLIN 2025-08-06 11:24:15 +02:00
parent 1d6d97ef25
commit a18c115ef1
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
7 changed files with 90 additions and 26 deletions

View file

@ -3,10 +3,10 @@
/* ::: :::::::: */
/* player.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tchampio <tchampio@student.42lehavre. +#+ +:+ +#+ */
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/29 11:42:44 by tchampio #+# #+# */
/* Updated: 2025/07/29 20:13:01 by tchampio ### ########.fr */
/* Created: 2025/08/06 11:29:14 by kcolin #+# #+# */
/* Updated: 2025/08/06 11:29:14 by kcolin ### ########.fr */
/* */
/* ************************************************************************** */
@ -59,7 +59,6 @@ void init_player(t_player *player, t_mapdata *map)
dir = map->map[map->starty][map->startx];
player->x = map->startx + 0.5;
player->y = map->starty + 0.5;
map->map[map->starty][map->startx] = '0';
player->health = 100;
player->points = 500;
if (dir == 'N' || dir == 'S')