From 82664c5d136056a40d0f27950ba64e7733aa470c Mon Sep 17 00:00:00 2001 From: Theo Champion Date: Thu, 18 Sep 2025 12:30:41 +0200 Subject: [PATCH] fix: replaced magic values for their variables counterparts --- src/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.c b/src/main.c index 3224d56..865b4bb 100644 --- a/src/main.c +++ b/src/main.c @@ -6,7 +6,7 @@ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */ -/* Updated: 2025/09/17 16:55:39 by tchampio ### ########.fr */ +/* Updated: 2025/09/18 12:28:33 by tchampio ### ########.fr */ /* */ /* ************************************************************************** */ @@ -56,15 +56,15 @@ void handle_shooting(t_cub3d_data *data) if (data->player.weapon->clip <= 0 && data->player.weapon->remaining_ammos > 0) { ft_printf("reloading\n"); - if (data->player.weapon->remaining_ammos < 8) + if (data->player.weapon->remaining_ammos < data->player.weapon->base_clip) { data->player.weapon->clip = data->player.weapon->remaining_ammos; data->player.weapon->remaining_ammos = 0; } else { - data->player.weapon->clip = 8; - data->player.weapon->remaining_ammos -= 8; + data->player.weapon->clip = data->player.weapon->base_clip; + data->player.weapon->remaining_ammos -= data->player.weapon->base_clip; } } if (data->player.weapon->clip <= 0) @@ -74,7 +74,7 @@ void handle_shooting(t_cub3d_data *data) data->player.weapon->clip--; if (data->player.aimed_zombie) { - data->player.aimed_zombie->health -= 32; + data->player.aimed_zombie->health -= data->player.weapon->damages; data->player.points += 10; ft_printf("Shooting %p, now at %d HP %d/%d\n", data->player.aimed_zombie, data->player.aimed_zombie->health, data->player.weapon->clip, data->player.weapon->remaining_ammos);