From cef8206af446060fde641c7b2ed868af671eaa4e Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 26 Jan 2023 09:10:24 -0800 Subject: [PATCH] \#version warning fix Avoid #ifdef/#else/#endif inside expansion of Strcat() macro. Also, change constructed |soundlib_nosound, soundlib_macsound, and soundlib_qtsound, user sounds. to be |nosound, macsound, qtsound, and user sounds. OPTIONS=soundlib:somelib doesn't--or won't, when finished being implemented--include the "soundlib_" prefix in the user-visible value, and placement of "and" vs "user sounds" was odd. The code should probably be reorganized so that makedefs can put that into dat/options or at least have it put a placeholder for the missing paragraph. --- src/mdlib.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/mdlib.c b/src/mdlib.c index 0136dfe36..0afae3b07 100644 --- a/src/mdlib.c +++ b/src/mdlib.c @@ -861,26 +861,28 @@ build_options(void) optbuf[0] = '\0'; length = COLNO + 1; /* force 1st item onto new line */ +#ifdef USER_SOUNDS + soundlibcnt += 1; +#endif for (i = 0; i < SIZE(soundlib_opts) - 1; i++) { + const char *soundlib; + if (!soundlib_opts[i].valid) continue; - Sprintf(buf, "\"%s\"", soundlib_opts[i].text_id); + soundlib = soundlib_opts[i].text_id; + if (!strncmp(soundlib, "soundlib_", 9)) + soundlib += 9; + Sprintf(buf, "\"%s\"", soundlib); /* * 1 : foo. - * 2 : foo and bar, - * 3+: for, bar, and quux, - * - * 2+ will be followed by " with a default of..." + * 2 : foo and bar. + * 3+: for, bar, and quux. */ - Strcat(buf, (soundlibcnt == 1) ? "." /* no 'default' */ + Strcat(buf, (soundlibcnt == 1 || cnt == soundlibcnt - 1) + ? "." /* no 'with default' */ : (soundlibcnt == 2 && cnt == 0) ? " and" : (cnt == soundlibcnt - 2) ? ", and" -#ifdef USER_SOUNDS - : "," -#else - : "." -#endif - ); + : ","); opt_out_words(buf, &length); cnt++; }