]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Do some cleaning up... in the process: fix one thing, break another.
authorSamual Lenks <samual@xonotic.org>
Fri, 8 Feb 2013 09:53:02 +0000 (04:53 -0500)
committerSamual Lenks <samual@xonotic.org>
Fri, 8 Feb 2013 09:53:02 +0000 (04:53 -0500)
qcsrc/common/notifications.qc
qcsrc/common/notifications.qh

index 54af4120ec5452da2639bafae6c83eda46b506f2..c605a0255f8abf337ea8ec47e69cb34bc1060590 100644 (file)
@@ -153,8 +153,6 @@ void Local_Notification(float net_type, float net_name, ...count)
                float f2 = (((stringcount + 1) < count) ? ...((stringcount + 1), float) : NO_FL_ARG);
                float f3 = (((stringcount + 2) < count) ? ...((stringcount + 2), float) : NO_FL_ARG);
                float f4 = (((stringcount + 3) < count) ? ...((stringcount + 3), float) : NO_FL_ARG);
-
-               string tmp_s;
                
                dprint("Local_Notification(", ftos(net_type), ", ", Get_Field_Value(F_NAME, net_type, net_name), strcat(", ", s1, ", ", s2, ", ", s3, ", ", s4, ", "), strcat(ftos(f1), strcat(", ", ftos(f2), ", ", ftos(f3), ", ", ftos(f4), ");\n")));
                dprint("  ^--: stringcount: ", ftos(stringcount), ", floatcount: ", ftos(floatcount), ".\n");
@@ -169,16 +167,11 @@ void Local_Notification(float net_type, float net_name, ...count)
                                #define MSG_INFO_NOTIF(name,strnum,flnum,args,hudargs,icon,normal,gentle) \
                                        case name: { CHECK_AUTOCVAR(name) \
                                        { \
-                                               tmp_s = normal_or_gentle(normal, gentle); if(tmp_s != "") \
-                                               { \
-                                                       if(substring(tmp_s, (strlen(tmp_s) - 1), 1) == "\n") { print(sprintf(CCR(tmp_s), args)); } \
-                                                       else { backtrace(strcat("^1MISSING/BROKEN NEW LINE AT END OF NOTIFICATION: ^7net_type = MSG_INFO, net_name = ", Get_Field_Value(F_NAME, net_type, net_name), (GENTLE ? ", GENTLE string" : ", NORMAL string"), ".\n")); } \
-                                                       #ifdef CSQC \
-                                                               tmp_s = icon; if(tmp_s != "") { HUD_Notify_Push(icon, hudargs); } \
-                                                       #endif \
-                                               } \
-                                               else { backtrace(strcat("^1EMPTY NOTIFICATION: ^7net_type = MSG_INFO, net_name = ", Get_Field_Value(F_NAME, net_type, net_name), ".\n")); } \
-                                       } } break;
+                                               print(sprintf(CCR(normal_or_gentle(normal, gentle)), args)); \
+                                               #ifdef CSQC \
+                                                       if(icon != "") { HUD_Notify_Push(icon, hudargs); } \
+                                               #endif \
+                                       } return; }
                                        
                                switch(net_name)
                                {
@@ -195,9 +188,8 @@ void Local_Notification(float net_type, float net_name, ...count)
                                #define MSG_CENTER_NOTIF(name,strnum,flnum,args,cpid,durcnt,normal,gentle) \
                                        case name: { CHECK_AUTOCVAR(name) \
                                        { \
-                                               tmp_s = normal_or_gentle(normal, gentle); if(tmp_s != "") { centerprint_generic(HANDLE_CPID(cpid), sprintf(CCR(tmp_s), args), durcnt); } \
-                                               else { backtrace(strcat("^1EMPTY NOTIFICATION: ^7net_type = MSG_CENTER, net_name = ", Get_Field_Value(F_NAME, net_type, net_name), ".\n")); } \
-                                       } } break;
+                                               centerprint_generic(HANDLE_CPID(cpid), sprintf(CCR(normal_or_gentle(normal, gentle)), args), durcnt); \
+                                       } return; }
 
                                switch(net_name)
                                {
@@ -228,7 +220,7 @@ void Local_Notification(float net_type, float net_name, ...count)
                                                                        s1, s2, s3, s4, f1, f2, f3, f4); \
                                                        #endif \
                                                #endif \
-                                       } } break;
+                                       } return; }
 
                                switch(net_name)
                                {
@@ -242,7 +234,7 @@ void Local_Notification(float net_type, float net_name, ...count)
                        case MSG_DEATH:
                        {
                                #define MSG_DEATH_NOTIF(name,infoname,centername) \
-                                       { if(min(name,10000) == net_name) CHECK_AUTOCVAR(name) \
+                                       case name: { CHECK_AUTOCVAR(name) \
                                        { \
                                                #if infoname != NO_MSG \
                                                        Local_Notification_Without_VarArgs(MSG_INFO, infoname, \
@@ -258,10 +250,13 @@ void Local_Notification(float net_type, float net_name, ...count)
                                                                        s1, s2, s3, s4, f1, f2, f3, f4); \
                                                        #endif \
                                                #endif \
-                                       } } 
-
-                               MSG_DEATH_NOTIFICATIONS
+                                       } return; } 
 
+                               switch(net_name)
+                               {
+                                       MSG_DEATH_NOTIFICATIONS
+                                       default: { backtrace(strcat("^1NOTIFICATION HAD NO MATCH: ^7net_type = MSG_DEATH, net_name = ", ftos(net_name), ".\n")); break; }
+                               }
                                
                                #undef MSG_DEATH_NOTIF
                                break;
index 7c1fa8f28a86d8fbcd6c77d34d2456cddb5ae437..0340b2b18a768c599de7e945174b0607baeb3364 100644 (file)
@@ -236,7 +236,7 @@ void Send_CSQC_Centerprint_Generic_Expire(entity e, float id);
                MSG_INFO_NOTIF(prefix##PINK, strnum, flnum, args, hudargs, sprintf(icon, strtolower(STR_TEAM_4)), TCR(normal, COL_TEAM_4, strtoupper(STR_TEAM_4)), TCR(gentle, COL_TEAM_4, strtoupper(STR_TEAM_4))) \
        #endif
 #define MSG_INFO_NOTIFICATIONS \
-       MSG_INFO_NOTIF(INFO_EMPTY,                                                      0, 0, NO_STR_ARG, XPD("", ""),                                          "",                                             "", "") \
+       MSG_INFO_NOTIF(INFO_EMPTY,                                                      0, 0, NO_STR_ARG, XPD("", ""),                                          "",                                             "empty", "") \
        MULTITEAM_INFO(INFO_CTF_FLAGRETURN_DROPPED_, 2,         0, 0, NO_STR_ARG, XPD("", ""),                                          "",                                             _("^BGThe ^TC^TT^BG flag was dropped in the base and returned itself\n"), "") \
        MULTITEAM_INFO(INFO_CTF_FLAGRETURN_DAMAGED_, 2,         0, 0, NO_STR_ARG, XPD("", ""),                                          "",                                             _("^BGThe ^TC^TT^BG flag was destroyed and returned to base\n"), "") \
        MULTITEAM_INFO(INFO_CTF_FLAGRETURN_SPEEDRUN_, 2,        0, 1, f1/100, XPD("", ""),                                                      "",                                             _("^BGThe ^TC^TT^BG flag became impatient after ^F1%.2f^BG seconds and returned itself\n"), "") \
@@ -392,7 +392,7 @@ void Send_CSQC_Centerprint_Generic_Expire(entity e, float id);
                MSG_CENTER_NOTIF(prefix##PINK, strnum, flnum, args, cpid, durcnt, TCR(normal, COL_TEAM_4, strtoupper(STR_TEAM_4)), TCR(gentle, COL_TEAM_4, strtoupper(STR_TEAM_4))) \
        #endif
 #define MSG_CENTER_NOTIFICATIONS \
-       MSG_CENTER_NOTIF(CENTER_EMPTY,                                                  0, 0, NO_STR_ARG,                               NO_CPID,                                XPD(0, 0), "", "") \
+       MSG_CENTER_NOTIF(CENTER_EMPTY,                                                  0, 0, NO_STR_ARG,                               NO_CPID,                                XPD(0, 0), "null", "") \
        MSG_CENTER_NOTIF(CENTER_ASSAULT_ATTACKING,                              0, 0, NO_STR_ARG,                               CPID_ASSAULT_ROLE,              XPD(0, 0), _("^BGYou are attacking!"), "") \
        MSG_CENTER_NOTIF(CENTER_ASSAULT_DEFENDING,                              0, 0, NO_STR_ARG,                               CPID_ASSAULT_ROLE,              XPD(0, 0), _("^BGYou are defending!"), "") \
        MSG_CENTER_NOTIF(CENTER_CTF_CAPTURESHIELD_SHIELDED,             0, 0, NO_STR_ARG,                               CPID_CTF_CAPSHIELD,             XPD(0, 0), _("^BGYou are now ^F1shielded^BG from the flag\n^BGfor ^F2too many unsuccessful attempts^BG to capture.\n^BGMake some defensive scores before trying again."), "") \
@@ -596,7 +596,6 @@ void Send_CSQC_Centerprint_Generic_Expire(entity e, float id);
 #define NOTIF_FIRST 1
 #define NOTIF_MAX 1024 // limit of recursive functions with ACCUMULATE_FUNCTION
 
-
 #define CHECK_NOTIFICATION_1(net_type,net_name,check_newline,normal,gentle) \
        if((normal == "") || ((normal == "") && (gentle == ""))) { print(strcat("^1EMPTY NOTIFICATION: ^7net_type = ", net_type, ", net_name = ", VAR_TO_TEXT(net_name), ".\n")); } \
        #if check_newline \
@@ -607,8 +606,7 @@ void Send_CSQC_Centerprint_Generic_Expire(entity e, float id);
                } \
        #endif
 
-#define CHECK_NOTIFICATION_2(net_type,net_name,infoname,centername) \
-       if not(#infoname || #centername) { print(strcat("^1NOTIFICATION WITH NO SUBCALLS: ^7net_type = ", net_type, ", net_name = ", VAR_TO_TEXT(net_name), ".\n")); }
+#define CHECK_NOTIFICATION_2(net_type,net_name,infoname,centername) if not(#infoname || #centername) { print(strcat("^1NOTIFICATION WITH NO SUBCALLS: ^7net_type = ", net_type, ", net_name = ", VAR_TO_TEXT(net_name), ".\n")); }
        
 float NOTIF_INFO_COUNT;
 float NOTIF_CENTER_COUNT;
@@ -625,7 +623,7 @@ float NOTIF_CPID_COUNT;
        { \
                SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_INFO_COUNT) \
                CHECK_MAX_COUNT(name, NOTIF_MAX, NOTIF_INFO_COUNT, "notifications") \
-               CHECK_NOTIFICATION_1("MSG_INFO", name, TRUE, normal, gentle) \
+               /*CHECK_NOTIFICATION_1("MSG_INFO", name, TRUE, normal, gentle)*/ \
        } \
        ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
 
@@ -640,7 +638,7 @@ float NOTIF_CPID_COUNT;
                SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_CENTER_COUNT) \
                SET_FIELD_COUNT(cpid, NOTIF_FIRST, NOTIF_CPID_COUNT) \
                CHECK_MAX_COUNT(name, NOTIF_MAX, NOTIF_CENTER_COUNT, "notifications") \
-               CHECK_NOTIFICATION_1("MSG_CENTER", name, FALSE, normal, gentle) \
+               /*CHECK_NOTIFICATION_1("MSG_CENTER", name, FALSE, normal, gentle)*/ \
        } \
        ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
 
@@ -653,7 +651,7 @@ float NOTIF_CPID_COUNT;
        { \
                SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_WEAPON_COUNT) \
                CHECK_MAX_COUNT(name, NOTIF_MAX, NOTIF_WEAPON_COUNT, "notifications") \
-               CHECK_NOTIFICATION_2("MSG_WEAPON", name, infoname, centername) \
+               /*CHECK_NOTIFICATION_2("MSG_WEAPON", name, infoname, centername)*/ \
        } \
        ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
 
@@ -666,7 +664,7 @@ float NOTIF_CPID_COUNT;
        { \
                SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_DEATH_COUNT) \
                CHECK_MAX_COUNT(name, NOTIF_MAX, NOTIF_DEATH_COUNT, "notifications") \
-               CHECK_NOTIFICATION_2("MSG_DEATH", name, infoname, centername) \
+               /*CHECK_NOTIFICATION_2("MSG_DEATH", name, infoname, centername)*/ \
        } \
        ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)