From 61659a08c8e5f2cf5469978b2e0ebba42b349ebf Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 24 Oct 2017 10:30:12 +0200 Subject: [PATCH] Reduce some duplicated code --- qcsrc/server/g_damage.qc | 60 ++++++++++++---------------------------- 1 file changed, 18 insertions(+), 42 deletions(-) diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index e46ff1fe6..adaa8c369 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -183,49 +183,25 @@ void Obituary_SpecialDeath( if(g_cts && deathtype == DEATH_KILL.m_id) return; // TODO: somehow put this in CTS gamemode file! - if(murder) + Notification death_message = (murder) ? deathent.death_msgmurder : deathent.death_msgself; + if(death_message) { - if(deathent.death_msgmurder) - { - Send_Notification_WOCOVA( - NOTIF_ONE, - notif_target, - MSG_MULTI, - deathent.death_msgmurder, - s1, s2, s3, "", - f1, f2, f3, 0 - ); - Send_Notification_WOCOVA( - NOTIF_ALL_EXCEPT, - notif_target, - MSG_INFO, - deathent.death_msgmurder.nent_msginfo, - s1, s2, s3, "", - f1, f2, f3, 0 - ); - } - } - else - { - if(deathent.death_msgself) - { - Send_Notification_WOCOVA( - NOTIF_ONE, - notif_target, - MSG_MULTI, - deathent.death_msgself, - s1, s2, s3, "", - f1, f2, f3, 0 - ); - Send_Notification_WOCOVA( - NOTIF_ALL_EXCEPT, - notif_target, - MSG_INFO, - deathent.death_msgself.nent_msginfo, - s1, s2, s3, "", - f1, f2, f3, 0 - ); - } + Send_Notification_WOCOVA( + NOTIF_ONE, + notif_target, + MSG_MULTI, + death_message, + s1, s2, s3, "", + f1, f2, f3, 0 + ); + Send_Notification_WOCOVA( + NOTIF_ALL_EXCEPT, + notif_target, + MSG_INFO, + death_message.nent_msginfo, + s1, s2, s3, "", + f1, f2, f3, 0 + ); } } -- 2.39.2