From c69b50d4b914d4febf9e66fab37565049d5d5265 Mon Sep 17 00:00:00 2001 From: terencehill Date: Thu, 7 Feb 2019 19:15:05 +0100 Subject: [PATCH] Compress code of all the NOTIF_WRITE_* macros (now possible thanks to the new implementation of NOTIF_WRITE) --- qcsrc/common/notifications/all.qc | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/qcsrc/common/notifications/all.qc b/qcsrc/common/notifications/all.qc index 04fc75e8f..26b8a2bec 100644 --- a/qcsrc/common/notifications/all.qc +++ b/qcsrc/common/notifications/all.qc @@ -779,31 +779,25 @@ void Dump_Notifications(int fh, bool alsoprint) { #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( \ + #define NOTIF_WRITE_HARDCODED(cvar, default, description) \ + NOTIF_WRITE(sprintf( \ "seta notification_%s \"%s\" \"%s\"\n", \ cvar, default, description \ - ); \ - NOTIF_WRITE(notif_msg); \ - MACRO_END + )) // 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 -- 2.39.2