From: terencehill <piuntn@gmail.com>
Date: Wed, 2 Nov 2022 23:15:14 +0000 (+0100)
Subject: LMS: correctly update last forfeiter's health and armor if they forfeited when dead
X-Git-Tag: xonotic-v0.8.6~67^2~1
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f593f094866ee463d77f90812b818ca3e731cae3;p=xonotic%2Fxonotic-data.pk3dir.git

LMS: correctly update last forfeiter's health and armor if they forfeited when dead

Also remove a TODO comment I resolved in the previous commit
---

diff --git a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc
index b2ab903cbd..013de60d66 100644
--- a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc
+++ b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc
@@ -367,17 +367,19 @@ void lms_RemovePlayer(entity player)
 			if(!warmup_stage)
 			{
 				int pl_lives = GameRules_scoring_add(player, LMS_LIVES, 0);
+				float pl_health = IS_DEAD(player) ? start_health : GetResource(player, RES_HEALTH);
+				float pl_armor = IS_DEAD(player) ? start_armorvalue : GetResource(player, RES_ARMOR);
 				if (!last_forfeiter_lives || pl_lives < last_forfeiter_lives)
 				{
 					last_forfeiter_lives = pl_lives;
-					last_forfeiter_health = GetResource(player, RES_HEALTH);
-					last_forfeiter_armorvalue = GetResource(player, RES_ARMOR);
+					last_forfeiter_health = pl_health;
+					last_forfeiter_armorvalue = pl_armor;
 				}
 				else if (pl_lives == last_forfeiter_lives)
 				{
 					// these values actually can belong to a different forfeiter
-					last_forfeiter_health = min(last_forfeiter_health, GetResource(player, RES_HEALTH));
-					last_forfeiter_armorvalue = min(last_forfeiter_armorvalue, GetResource(player, RES_ARMOR));
+					last_forfeiter_health = min(last_forfeiter_health, pl_health);
+					last_forfeiter_armorvalue = min(last_forfeiter_armorvalue, pl_armor);
 				}
 				GameRules_scoring_add(player, LMS_LIVES, -pl_lives);
 			}
diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc
index 671a324673..ec5616f979 100644
--- a/qcsrc/common/notifications/all.inc
+++ b/qcsrc/common/notifications/all.inc
@@ -707,7 +707,6 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input !=
     MULTITEAM_CENTER(KEYHUNT_START,                     N_ENABLE,    0, 0, "",               CPID_KEYHUNT,           "0 0",  _("^BGYou are starting with the ^TC^TT Key"), "", KEY)
 
     MSG_CENTER_NOTIF(LMS_NOLIVES,                       N_ENABLE,    0, 0, "",               CPID_LMS,               "0 0",  _("^BGYou have no lives left, you must wait until the next match"), "")
-    // TODO update notifications.cfg
     MSG_CENTER_NOTIF(LMS_VISIBLE_LEADER,                N_ENABLE,    0, 0, "",               CPID_LMS,               "0 0",  _("^BGEnemies can now see you on radar!"), "")
     MSG_CENTER_NOTIF(LMS_VISIBLE_OTHER,                 N_ENABLE,    0, 0, "",               CPID_LMS,               "0 0",  _("^BGLeaders can now be seen by enemies on radar!"), "")