X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fnotifications%2Fall.qc;h=11ebffacfa4e8762fe37d152185124005127b553;hb=c8d1187c6225c1d14ce4481d59a8abca5e79eb16;hp=438ff5d221c5618eacc1d54109d6040ac22be3d8;hpb=306d846b2583c3d4346c120725f8506a79af47f8;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/notifications/all.qc b/qcsrc/common/notifications/all.qc index 438ff5d22..11ebffacf 100644 --- a/qcsrc/common/notifications/all.qc +++ b/qcsrc/common/notifications/all.qc @@ -777,54 +777,43 @@ void Notification_GetCvars(entity this) /** used to output notifications.cfg file */ void Dump_Notifications(int fh, bool alsoprint) { - #define NOTIF_WRITE(a) MACRO_BEGIN \ - fputs(fh, a); \ - if (alsoprint) LOG_INFO(a); \ - MACRO_END + #define NOTIF_WRITE(str) write_String_To_File(fh, str, alsoprint) - #define NOTIF_WRITE_ENTITY(e, description) MACRO_BEGIN \ - string notif_msg = sprintf( \ + #define NOTIF_WRITE_ENTITY(e, description) \ + NOTIF_WRITE(sprintf( \ "seta notification_%s \"%d\" \"%s\"\n", \ Get_Notif_CvarName(e), e.nent_default, description \ - ); \ - NOTIF_WRITE(notif_msg); \ - MACRO_END + )) - #define NOTIF_WRITE_ENTITY_CHOICE(e, descriptiona, descriptionb) MACRO_BEGIN \ - string notif_msg = sprintf( \ + #define NOTIF_WRITE_ENTITY_CHOICE(e, descriptiona, descriptionb) \ + NOTIF_WRITE(sprintf( \ "seta notification_%s \"%d\" \"%s\"\n" \ "seta notification_%s_ALLOWED \"%d\" \"%s\"\n", \ Get_Notif_CvarName(e), e.nent_default, descriptiona, \ Get_Notif_CvarName(e), e.nent_challow_def, descriptionb \ - ); \ - NOTIF_WRITE(notif_msg); \ - MACRO_END - - #define NOTIF_WRITE_HARDCODED(cvar, default, description) MACRO_BEGIN \ - string notif_msg = sprintf( \ - "seta notification_%s \"%s\" \"%s\"\n", \ - cvar, default, description \ - ); \ - NOTIF_WRITE(notif_msg); \ - MACRO_END + )) + + #define NOTIF_WRITE_HARDCODED(cvar, default, description) \ + NOTIF_WRITE("seta notification_" cvar " \"" default "\" \"" description "\"\n") // Note: This warning only applies to the notifications.cfg file that is output... // You ARE supposed to manually edit this function to add i.e. hard coded // notification variables for mutators or game modes or such and then // regenerate the notifications.cfg file from the new code. - NOTIF_WRITE("// ********************************************** //\n"); - NOTIF_WRITE("// ** WARNING - DO NOT MANUALLY EDIT THIS FILE ** //\n"); - NOTIF_WRITE("// ** ** //\n"); - NOTIF_WRITE("// ** This file is automatically generated ** //\n"); - NOTIF_WRITE("// ** by code with the command 'dumpnotifs'. ** //\n"); - NOTIF_WRITE("// ** ** //\n"); - NOTIF_WRITE("// ** If you add a new notification, please ** //\n"); - NOTIF_WRITE("// ** regenerate this file with that command ** //\n"); - NOTIF_WRITE("// ** making sure that the output matches ** //\n"); - NOTIF_WRITE("// ** with the lists and defaults in code. ** //\n"); - NOTIF_WRITE("// ** ** //\n"); - NOTIF_WRITE("// ********************************************** //\n"); + NOTIF_WRITE( + "// ********************************************** //\n" + "// ** WARNING - DO NOT MANUALLY EDIT THIS FILE ** //\n" + "// ** ** //\n" + "// ** This file is automatically generated ** //\n" + "// ** by code with the command 'dumpnotifs'. ** //\n" + "// ** ** //\n" + "// ** If you add a new notification, please ** //\n" + "// ** regenerate this file with that command ** //\n" + "// ** making sure that the output matches ** //\n" + "// ** with the lists and defaults in code. ** //\n" + "// ** ** //\n" + "// ********************************************** //\n"); // These notifications will also append their string as a comment... // This is not necessary, and does not matter if they vary between config versions,