SOUND=foo vs !defined(USER_SOUNDS)

Give a better message than "Unknown config statement" if SOUNDDIR or
SOUND directives are found in the configuration file being loaded by
an executable built without support for USER_SOUNDS.  And just give
it for the first occurrence since when present there will likely be
multiple SOUND instances.

It doesn't attempt to deal with the case where the current interface
does not support sound but USER_SOUNDS is enabled because another
interface in the same executable does.
This commit is contained in:
PatR
2021-11-26 21:56:58 -08:00
parent e88126cf6f
commit 629c2c4094
3 changed files with 13 additions and 1 deletions

View File

@@ -930,6 +930,9 @@ struct instance_globals {
char *config_section_chosen;
char *config_section_current;
int nesting;
int no_sound_notified; /* run-time option processing: warn once if built
* without USER_SOUNDS and config file contains
* SOUND=foo or SOUNDDIR=bar */
int symset_count; /* for pick-list building only */
boolean chosen_symset_start;
boolean chosen_symset_end;

View File

@@ -407,6 +407,7 @@ const struct instance_globals g_init = {
NULL, /* config_section_chosen */
NULL, /* config_section_current */
0, /* nesting */
0, /* no_sound_notified */
0, /* symset_count */
FALSE, /* chosen_symset_start */
FALSE, /* chosen_symset_end */

View File

@@ -2773,7 +2773,15 @@ parse_config_line(char *origbuf)
sounddir = dupstr(bufp);
} else if (match_varname(buf, "SOUND", 5)) {
add_sound_mapping(bufp);
#endif
#else /* !USER_SOUNDS */
} else if (match_varname(buf, "SOUNDDIR", 8)
|| match_varname(buf, "SOUND", 5)) {
if (!g.no_sound_notified++) {
config_error_add("SOUND and SOUNDDIR are not available.");
}
; /* skip this and any further SOUND or SOUNDDIR lines
* but leave 'retval' set to True */
#endif /* ?USER_SOUNDS */
} else if (match_varname(buf, "QT_TILEWIDTH", 12)) {
#ifdef QT_GRAPHICS
extern char *qt_tilewidth;