From: terencehill Date: Tue, 24 Oct 2017 08:30:12 +0000 (+0200) Subject: Reduce some duplicated code X-Git-Tag: xonotic-v0.8.5~2442 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=61659a08c8e5f2cf5469978b2e0ebba42b349ebf;p=xonotic%2Fxonotic-data.pk3dir.git Reduce some duplicated code --- 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 + ); } }