\#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.
This commit is contained in:
PatR
2023-01-26 09:10:24 -08:00
parent 3a2d6d6d0a
commit cef8206af4

View File

@@ -861,26 +861,28 @@ build_options(void)
optbuf[0] = '\0'; optbuf[0] = '\0';
length = COLNO + 1; /* force 1st item onto new line */ length = COLNO + 1; /* force 1st item onto new line */
#ifdef USER_SOUNDS
soundlibcnt += 1;
#endif
for (i = 0; i < SIZE(soundlib_opts) - 1; i++) { for (i = 0; i < SIZE(soundlib_opts) - 1; i++) {
const char *soundlib;
if (!soundlib_opts[i].valid) if (!soundlib_opts[i].valid)
continue; 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. * 1 : foo.
* 2 : foo and bar, * 2 : foo and bar.
* 3+: for, bar, and quux, * 3+: for, bar, and quux.
*
* 2+ will be followed by " with a default of..."
*/ */
Strcat(buf, (soundlibcnt == 1) ? "." /* no 'default' */ Strcat(buf, (soundlibcnt == 1 || cnt == soundlibcnt - 1)
? "." /* no 'with default' */
: (soundlibcnt == 2 && cnt == 0) ? " and" : (soundlibcnt == 2 && cnt == 0) ? " and"
: (cnt == soundlibcnt - 2) ? ", and" : (cnt == soundlibcnt - 2) ? ", and"
#ifdef USER_SOUNDS : ",");
: ","
#else
: "."
#endif
);
opt_out_words(buf, &length); opt_out_words(buf, &length);
cnt++; cnt++;
} }