From 4231058a46a2c9a3c3a34a2efc8b54e12b361824 Mon Sep 17 00:00:00 2001 From: drjaska Date: Thu, 11 Jul 2024 00:09:58 +0300 Subject: [PATCH] Add a missing if check for flag waypoint health The waypoint usage here was missing a check that it has been initialised properly. Without waypoint updating code assumed that the flag has >0 max_health which caused many div by zero errors. Added the following if check: autocvar_g_ctf_flag_return_time || (autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health) --- qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc index 747dbe88c..e83608785 100644 --- a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc +++ b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc @@ -799,7 +799,11 @@ void ctf_CheckFlagReturn(entity flag, int returntype) { if((flag.ctf_status == FLAG_DROPPED) || (flag.ctf_status == FLAG_PASSING)) { - if(flag.wps_flagdropped) { WaypointSprite_UpdateHealth(flag.wps_flagdropped, GetResource(flag, RES_HEALTH)); } + if (flag.wps_flagdropped + && (autocvar_g_ctf_flag_return_time || (autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health))) + { + WaypointSprite_UpdateHealth(flag.wps_flagdropped, GetResource(flag, RES_HEALTH)); + } if((GetResource(flag, RES_HEALTH) <= 0) || (time >= flag.ctf_droptime + autocvar_g_ctf_flag_return_time)) { -- 2.39.2