From cf06cc28208c0049a6b38b3d6fea7d29d06b4c73 Mon Sep 17 00:00:00 2001 From: Samual Lenks Date: Mon, 11 Feb 2013 15:32:12 -0500 Subject: [PATCH] Fix handling of entities with MSG_WEAPON and MSG_DEATH subcalls --- qcsrc/common/notifications.qc | 10 +++++----- qcsrc/common/notifications.qh | 21 +++++++++++++++++---- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc index cea5d3de2..43b27082c 100644 --- a/qcsrc/common/notifications.qc +++ b/qcsrc/common/notifications.qc @@ -88,13 +88,13 @@ string Get_Field_Value(float field, float net_type, float net_name) dprint(sprintf("Get_Field_Value(%d, %d, %d); - name=%s, stringcount=%d, floatcount=%d...\n", field, net_type, net_name, e.nent_name, e.nent_stringcount, e.nent_floatcount)); - switch(net_type) + switch(field) { case F_NAME: { return e.nent_name; } - case F_INFVAL: { return ftos(e.nent_infoname); } - case F_CENVAL: { return ftos(e.nent_centername); } - case F_STRNUM: { return ftos(e.nent_stringcount); } - case F_FLNUM: { return ftos(e.nent_stringcount); } + case F_INFVAL: { return ftos(e.nent_infoname); } + case F_CENVAL: { return ftos(e.nent_centername); } + case F_STRNUM: { return ftos(e.nent_stringcount); } + case F_FLNUM: { return ftos(e.nent_floatcount); } } return ""; diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh index a67f9af15..243aaaf3c 100644 --- a/qcsrc/common/notifications.qh +++ b/qcsrc/common/notifications.qh @@ -646,14 +646,26 @@ entity msg_death_notifs[NOTIF_MAX]; #define CREATE_NOTIF_ENTITY(type,name,infoname,centername,strnum,flnum,args,hudargs,icon,cpid,durcnt,normal,gentle,check_newline,subcalls) \ entity notif = spawn(); \ msg_##type##_notifs[name - 1] = notif; \ - notif.classname = "msg_##type##_notification"; \ + notif.classname = "msg_#type#_notification"; \ notif.nent_name = strzone(#name); \ #if subcalls \ #if (infoname == NO_MSG) && (centername == NO_MSG) \ print(sprintf("^1NOTIFICATION WITH NO SUBCALLS: ^7net_type = MSG_%s, net_name = %s.\n", strtoupper(#type), #name)); \ #else \ - if(infoname) { notif.nent_infoname = infoname; } \ - if(centername) { notif.nent_centername = centername; } \ + float infoname_stringcount = 0, infoname_floatcount = 0; \ + float centername_stringcount = 0, centername_floatcount = 0; \ + #if (infoname != NO_MSG) \ + notif.nent_infoname = infoname; \ + infoname_stringcount = msg_info_notifs[infoname - 1].nent_stringcount; \ + infoname_floatcount = msg_info_notifs[infoname - 1].nent_floatcount; \ + #endif \ + #if (centername != NO_MSG) \ + notif.nent_centername = centername; \ + centername_stringcount = msg_center_notifs[centername - 1].nent_stringcount; \ + centername_floatcount = msg_center_notifs[centername - 1].nent_floatcount; \ + #endif \ + notif.nent_stringcount = max(infoname_stringcount, centername_stringcount); \ + notif.nent_floatcount = max(infoname_floatcount, centername_floatcount); \ #endif \ #else \ notif.nent_stringcount = strnum; \ @@ -668,7 +680,8 @@ entity msg_death_notifs[NOTIF_MAX]; #else \ if(cpid != NO_MSG) { notif.nent_cpid = cpid; } \ #endif \ - #endif + #endif \ + eprint(notif); #define MSG_INFO_NOTIF(name,strnum,flnum,args,hudargs,icon,normal,gentle) \ -- 2.39.2