From: drjaska Date: Wed, 10 Jul 2024 21:09:58 +0000 (+0300) Subject: Add a missing if check for flag waypoint health X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4231058a46a2c9a3c3a34a2efc8b54e12b361824;p=xonotic%2Fxonotic-data.pk3dir.git 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) --- 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)) {