]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add comments to initialization code
authorSamual Lenks <samual@xonotic.org>
Sun, 24 Feb 2013 20:10:40 +0000 (15:10 -0500)
committerSamual Lenks <samual@xonotic.org>
Sun, 24 Feb 2013 20:10:40 +0000 (15:10 -0500)
qcsrc/common/notifications.qc
qcsrc/common/notifications.qh

index b5192cbe30bacc00aefcf9ba7a4d2e2eac3d60dd..4482df616e4a648ae26a54ca82a8f1c9b8a7c287 100644 (file)
@@ -104,8 +104,6 @@ void Dump_Notifications(float fh, float alsoprint)
        NOTIF_WRITE("seta notification_show_sprees_info 3 \"Show spree information in MSG_INFO messages... 0 = off, 1 = target only, 2 = attacker only, 3 = target and attacker\"\n");
        NOTIF_WRITE("seta notification_show_sprees_info_newline 0 \"Show attacker spree information for MSG_INFO messages on a separate line than the death notification itself\"\n");
        NOTIF_WRITE("seta notification_show_sprees_info_specialonly 1 \"Don't show attacker spree information in MSG_INFO messages if it isn't an achievement\"\n");
-       NOTIF_WRITE("seta notification_version_mismatch_client_error 0 \"Cause a notif error on client if the version in notifications.cfg mismatches the code\"\n");
-       NOTIF_WRITE("seta notification_version_mismatch_server_error 1 \"Cause a notif error on server if the version in notifications.cfg mismatches the code\"\n");
        NOTIF_WRITE("seta notification_errors_are_fatal 1 \"If a notification fails upon initialization, cause a Host_Error to stop the program\"\n");
        NOTIF_WRITE("seta notification_ctf_pickup_team_verbose 1 \"Show extra information if a team mate picks up a flag\"\n");
        NOTIF_WRITE("seta notification_ctf_pickup_enemy_verbose 1 \"Show extra information if an enemy picks up a flag\"\n");
index a754567d05a58b2ce9e69f37ef55ea1c09a74bfe..706bc0bf1ac85a5f265569db64c206844f008805 100644 (file)
@@ -958,7 +958,10 @@ string Process_Notif_Args(float arg_type, string args, string notiftype, string
 }
 
 #define CREATE_NOTIF_ENTITY(default,type,name,infoname,centername,strnum,flnum,args,hudargs,icon,cpid,durcnt,normal,gentle,check_newline,subcalls) \
+{ \
        notif_error = FALSE; \
+       \
+       /* global entity setup */ \
        entity notif = spawn(); \
        msg_##type##_notifs[name - 1] = notif; \
        notif.classname = "msg_#type#_notification"; \
@@ -966,7 +969,9 @@ string Process_Notif_Args(float arg_type, string args, string notiftype, string
        notif.nent_name = strzone(#name); \
        notif.nent_id = name; \
        notif.nent_enabled = (1 <= autocvar_notification_##name); \
-       #if subcalls \
+       \
+       /* notification specific settings */ \
+       #if subcalls /* MSG_DEATH and MSG_WEAPON */ \
                #if (infoname == NO_MSG) && (centername == NO_MSG) \
                        print(sprintf("^1NOTIFICATION WITH NO SUBCALLS: ^7net_type = MSG_%s, net_name = %s.\n", strtoupper(#type), #name)); \
                        notif_error = TRUE; \
@@ -982,18 +987,27 @@ string Process_Notif_Args(float arg_type, string args, string notiftype, string
                                centername_stringcount = notif.nent_msgcenter.nent_stringcount; \
                                centername_floatcount = notif.nent_msgcenter.nent_floatcount; \
                        #endif \
+                       /* set the requirements of THIS notification to the total requirements of its subcalls */ \
                        notif.nent_stringcount = max(infoname_stringcount, centername_stringcount); \
                        notif.nent_floatcount = max(infoname_floatcount, centername_floatcount); \
                #endif \
-       #else \
+       #else /* MSG_INFO and MSG_CENTER */ \
                float nent_chat = (autocvar_notification_##name > 1); \
+               \
                notif.nent_stringcount = strnum; \
                notif.nent_floatcount = flnum; \
                if(args != "") { notif.nent_args = strzone(Process_Notif_Args(1, args, strtoupper(#type), #name)); } \
-               if(hudargs != "") { notif.nent_hudargs = strzone(Process_Notif_Args(2, hudargs, strtoupper(#type), #name)); } \
-               if(icon != "") { notif.nent_icon = strzone(icon); } \
+               \
+               /* MSG_INFO only */ \
+                       if(hudargs != "") { notif.nent_hudargs = strzone(Process_Notif_Args(2, hudargs, strtoupper(#type), #name)); } \
+                       if(icon != "") { notif.nent_icon = strzone(icon); } \
+               \
+               /* MSG_CENTER only */ \
                if(cpid != NO_MSG) { notif.nent_cpid = cpid; } \
                if(durcnt != "") { notif.nent_durcnt = strzone(Process_Notif_Args(3, durcnt, strtoupper(#type), #name)); } \
+               \
+               /* string setup */ \
+               /* select gentle/normal string and bake color codes in on init, this way it does not need to be re-processed at run time */ \
                if(GENTLE) \
                { \
                        if(gentle != "") { notif.nent_string = strzone(CCR(Process_Notif_Line(check_newline, nent_chat, gentle, strtoupper(#type), #name, "GENTLE"))); } \
@@ -1002,11 +1016,14 @@ string Process_Notif_Args(float arg_type, string args, string notiftype, string
                else if(normal != "") { notif.nent_string = strzone(CCR(Process_Notif_Line(check_newline, nent_chat, normal, strtoupper(#type), #name, "NORMAL"))); } \
                if(notif.nent_string == "") { print(sprintf("^1EMPTY NOTIFICATION: ^7net_type = MSG_%s, net_name = %s.\n", strtoupper(#type), #name)); notif_error = TRUE; } \
        #endif \
+       \
+       /* now check to see if any errors happened */ \
        if(notif_error) \
        { \
-               notif.nent_enabled = FALSE; \
-               notif_global_error = TRUE; \
-       }
+               notif.nent_enabled = FALSE; /* disable the notification so it can't cause trouble */ \
+               notif_global_error = TRUE; /* throw the red flag that an error happened on init */ \
+       } \
+}
 
 #define MSG_INFO_NOTIF(default,name,strnum,flnum,args,hudargs,icon,normal,gentle) \
        NOTIF_ADD_AUTOCVAR(name, default) \