From: Samual Lenks Date: Wed, 27 Feb 2013 01:39:54 +0000 (-0500) Subject: Cleanup Read_Notification a little X-Git-Tag: xonotic-v0.7.0~62^2~23^2~95 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a61ef3e06f23af8adfb7f956835f052a54800678;p=xonotic%2Fxonotic-data.pk3dir.git Cleanup Read_Notification a little --- diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc index 02564c862..88c2d71b1 100644 --- a/qcsrc/common/notifications.qc +++ b/qcsrc/common/notifications.qc @@ -456,22 +456,11 @@ void Read_Notification(float is_new) float net_type = ReadByte(); float net_name = ReadShort(); - #ifdef NOTIFICATIONS_DEBUG - dprint(sprintf("Read_Notification(%d) at %f: net_type = %s", is_new, time, Get_Notif_TypeName(net_type))); - #endif - if(net_type == MSG_CENTER_KILL) { - #ifdef NOTIFICATIONS_DEBUG - dprint("\n"); - #endif if(is_new) { - if(net_name == 0) - { - print("clearing all centerprints\n"); - reset_centerprint_messages(); - } + if(net_name == 0) { reset_centerprint_messages(); } else { entity notif = Get_Notif_Ent(MSG_CENTER, net_name); @@ -479,33 +468,34 @@ void Read_Notification(float is_new) centerprint_generic(notif.nent_cpid, "", 0, 0); } } - return; } - - entity notif = Get_Notif_Ent(net_type, net_name); - if not(notif) { print("Read_Notification: Could not find notification entity!\n"); return; } + else + { + entity notif = Get_Notif_Ent(net_type, net_name); + if not(notif) { print("Read_Notification: Could not find notification entity!\n"); return; } - #ifdef NOTIFICATIONS_DEBUG - dprint(sprintf(", net_name = %s.\n", notif.nent_name)); - #endif + #ifdef NOTIFICATIONS_DEBUG + dprint(sprintf("Read_Notification(%d) at %f: net_type = %s, net_name = %s\n", is_new, time, Get_Notif_TypeName(net_type), notif.nent_name)); + #endif - string s1 = ((0 < notif.nent_stringcount) ? ReadString() : ""); - string s2 = ((1 < notif.nent_stringcount) ? ReadString() : ""); - string s3 = ((2 < notif.nent_stringcount) ? ReadString() : ""); - string s4 = ((3 < notif.nent_stringcount) ? ReadString() : ""); - float f1 = ((0 < notif.nent_floatcount) ? ReadLong() : 0); - float f2 = ((1 < notif.nent_floatcount) ? ReadLong() : 0); - float f3 = ((2 < notif.nent_floatcount) ? ReadLong() : 0); - float f4 = ((3 < notif.nent_floatcount) ? ReadLong() : 0); + string s1 = ((0 < notif.nent_stringcount) ? ReadString() : ""); + string s2 = ((1 < notif.nent_stringcount) ? ReadString() : ""); + string s3 = ((2 < notif.nent_stringcount) ? ReadString() : ""); + string s4 = ((3 < notif.nent_stringcount) ? ReadString() : ""); + float f1 = ((0 < notif.nent_floatcount) ? ReadLong() : 0); + float f2 = ((1 < notif.nent_floatcount) ? ReadLong() : 0); + float f3 = ((2 < notif.nent_floatcount) ? ReadLong() : 0); + float f4 = ((3 < notif.nent_floatcount) ? ReadLong() : 0); - if(is_new) - { - Local_Notification_WOVA( - net_type, net_name, - notif.nent_stringcount, - notif.nent_floatcount, - s1, s2, s3, s4, - f1, f2, f3, f4); + if(is_new) + { + Local_Notification_WOVA( + net_type, net_name, + notif.nent_stringcount, + notif.nent_floatcount, + s1, s2, s3, s4, + f1, f2, f3, f4); + } } } #endif