const char *alias;
const char *descr;
const char *prefixgw;
- boolean initval, has_handler, unused;
+ boolean initval, has_handler, dupdetected;
};
#endif /* OPTLIST_H */
&iflags.perm_invent)
NHOPTC(petattr, 88, opt_in, set_in_game, No, Yes, No, No, NoAlias,
"attributes for highlighting pets")
- NHOPTC(pettype, 4, opt_in, set_gameview, Yes, Yes, No, No, NoAlias,
+ NHOPTC(pettype, 4, opt_in, set_gameview, Yes, Yes, No, No, "pet",
"your preferred initial pet type")
NHOPTC(pickup_burden, 20, opt_in, set_in_game, No, Yes, No, Yes, NoAlias,
"maximum burden picked up before prompt")
NHOPTB(showrace, 0, opt_in, set_in_game, Off, Yes, No, No, NoAlias,
&flags.showrace)
#ifdef SCORE_ON_BOTL
- NHOPTB(showscore, 0, opt_in, set_in_game, Off, No, No, No, NoAlias,
+ NHOPTB(showscore, 0, opt_in, set_in_game, Off, Yes, No, No, NoAlias,
&flags.showscore)
#else
- NHOPTB(showscore, 0, opt_in, set_in_config, Off, No, No, No, NoAlias,
+ NHOPTB(showscore, 0, opt_in, set_in_config, Off, Yes, No, No, NoAlias,
(boolean *) 0)
#endif
NHOPTB(silent, 0, opt_out, set_in_game, On, Yes, No, No, NoAlias,
"video width")
NHOPTC(video_height, 10, opt_in, set_gameview, No, Yes, No, No, NoAlias,
"video height")
+#endif
+#ifdef TTY_TILES_ESCCODES
+ NHOPTB(vt_tiledata, 0, opt_out, set_in_config, On, Yes, No, No, NoAlias,
+ &iflags.vt_tiledata)
+#else
+ NHOPTB(vt_tiledata, 0, opt_out, set_in_config, On, Yes, No, No, NoAlias,
+ (boolean *) 0)
#endif
NHOPTC(warnings, 10, opt_in, set_in_config, No, Yes, No, No, NoAlias,
"display characters for warnings")
static int FDECL(change_inv_order, (char *));
static boolean FDECL(warning_opts, (char *, const char *));
static int FDECL(feature_alert_opts, (char *, const char *));
-static boolean FDECL(duplicate_opt_detection, (const char *, int));
-static void FDECL(complain_about_duplicate, (const char *, int));
+static boolean FDECL(duplicate_opt_detection, (int));
+static void FDECL(complain_about_duplicate, (int));
static int FDECL(length_without_val, (const char *, int len));
static void NDECL(determine_ambiguities);
static int FDECL(check_misc_menu_command, (char *, char *));
static boolean FDECL(add_menu_coloring_parsed, (char *, int, int));
static void FDECL(free_one_menu_coloring, (int));
static int NDECL(count_menucolors);
-static boolean FDECL(parse_role_opts, (BOOLEAN_P, const char *,
+static boolean FDECL(parse_role_opts, (int, BOOLEAN_P, const char *,
char *, char **));
static void FDECL(doset_add_menu, (winid, const char *, int, int));
static void FDECL(opts_add_others, (winid, const char *, int,
g.program_state.in_parseoptions++;
if (got_match && matchidx >= 0) {
- duplicate = duplicate_opt_detection(opts, 1);
+ duplicate = duplicate_opt_detection(matchidx);
if (duplicate && !allopt[matchidx].dupeok)
- complain_about_duplicate(opts, 1);
+ complain_about_duplicate(matchidx);
/* check for bad negation, so option functions don't have to */
if (negated && !allopt[matchidx].negateok) {
return optn_ok;
}
if (req == do_set) {
- if (parse_role_opts(negated, allopt[optidx].name, opts, &op)) {
+ if (parse_role_opts(optidx, negated, allopt[optidx].name, opts, &op)) {
if ((flags.initalign = str2align(op)) == ROLE_NONE) {
config_error_add("Unknown %s '%s'", allopt[optidx].name, op);
return optn_err;
}
if (req == do_set) {
/* gender:string */
- if (parse_role_opts(negated, allopt[optidx].name, opts, &op)) {
+ if (parse_role_opts(optidx, negated, allopt[optidx].name, opts, &op)) {
if ((flags.initgend = str2gend(op)) == ROLE_NONE) {
config_error_add("Unknown %s '%s'", allopt[optidx].name, op);
return optn_err;
#ifndef WIN32
if (duplicate)
- complain_about_duplicate(opts, 1);
+ complain_about_duplicate(optidx);
#endif
#ifdef MAC
if (match_optname(opts, "hicolor", 3, TRUE)) {
}
if (req == do_set) {
/* race:string */
- if (parse_role_opts(negated, allopt[optidx].name, opts, &op)) {
+ if (parse_role_opts(optidx, negated, allopt[optidx].name, opts, &op)) {
if ((flags.initrace = str2race(op)) == ROLE_NONE) {
config_error_add("Unknown %s '%s'", allopt[optidx].name, op);
return optn_err;
return optn_ok;
}
if (req == do_set) {
- if (parse_role_opts(negated, allopt[optidx].name, opts, &op)) {
+ if (parse_role_opts(optidx, negated, allopt[optidx].name, opts, &op)) {
if ((flags.initrole = str2role(op)) == ROLE_NONE) {
config_error_add("Unknown %s '%s'", allopt[optidx].name, op);
return optn_err;
return optn_err;
}
if (duplicate)
- complain_about_duplicate(opts, 1);
+ complain_about_duplicate(optidx);
if (opttype > 0 && !negated
&& (op = string_for_opt(opts, FALSE)) != empty_optstr) {
switch (opttype) {
return optn_err;
/* 0 means boolean opts */
- if (duplicate_opt_detection(allopt[optidx].name, 0))
- complain_about_duplicate(allopt[optidx].name, 0);
+ if (duplicate_opt_detection(optidx))
+ complain_about_duplicate(optidx);
op = string_for_opt(opts, TRUE);
if (op != empty_optstr) {
set_duplicate_opt_detection(on_or_off)
int on_or_off;
{
- int k, *optptr;
-
- if (on_or_off != 0) {
- /*-- ON --*/
- if (iflags.opt_booldup)
- impossible("iflags.opt_booldup already on (memory leak)");
- iflags.opt_booldup = (int *) alloc(SIZE(allopt) * sizeof (int));
- optptr = iflags.opt_booldup;
- for (k = 0; k < SIZE(allopt); ++k)
- *optptr++ = 0;
-
- if (iflags.opt_compdup)
- impossible("iflags.opt_compdup already on (memory leak)");
- iflags.opt_compdup = (int *) alloc(SIZE(allopt) * sizeof (int));
- optptr = iflags.opt_compdup;
- for (k = 0; k < SIZE(allopt); ++k)
- *optptr++ = 0;
- } else {
- /*-- OFF --*/
- if (iflags.opt_booldup)
- free((genericptr_t) iflags.opt_booldup);
- iflags.opt_booldup = (int *) 0;
- if (iflags.opt_compdup)
- free((genericptr_t) iflags.opt_compdup);
- iflags.opt_compdup = (int *) 0;
- }
+ int k;
+
+ for (k = 0; k < OPTCOUNT; ++k)
+ allopt[k].dupdetected = 0;
}
static boolean
-duplicate_opt_detection(opts, iscompound)
-const char *opts;
-int iscompound; /* 0 == boolean option, 1 == compound */
-{
- int i, *optptr;
-
- if (!iscompound && iflags.opt_booldup && g.opt_initial && g.opt_from_file) {
- for (i = 0; allopt[i].name; i++) {
- if (match_optname(opts, allopt[i].name, 3, FALSE)) {
- optptr = iflags.opt_booldup + i;
- *optptr += 1;
- if (*optptr > 1)
- return TRUE;
- else
- return FALSE;
- }
- }
- } else if (iscompound && iflags.opt_compdup && g.opt_initial && g.opt_from_file) {
- for (i = 0; allopt[i].name; i++) {
- if (match_optname(opts, allopt[i].name, strlen(allopt[i].name),
- TRUE)) {
- optptr = iflags.opt_compdup + i;
- *optptr += 1;
- if (*optptr > 1)
- return TRUE;
- else
- return FALSE;
- }
- }
- }
+duplicate_opt_detection(optidx)
+int optidx;
+{
+ if (g.opt_initial && g.opt_from_file)
+ return allopt[optidx].dupdetected;
return FALSE;
}
static void
-complain_about_duplicate(opts, iscompound)
-const char *opts;
-int iscompound; /* 0 == boolean option, 1 == compound */
+complain_about_duplicate(optidx)
+int optidx;
{
#ifdef MAC
/* the Mac has trouble dealing with the output of messages while
*/
#else /* !MAC */
config_error_add("%s option specified multiple times: %s",
- iscompound ? "compound" : "boolean", opts);
+ (allopt[optidx].opttyp == CompOpt) ? "compound" : "boolean",
+ allopt[optidx].name);
#endif /* ?MAC */
return;
}
init_random(rn2);
init_random(rn2_on_display_rng);
- /* for detection of configfile options specified multiple times */
- iflags.opt_booldup = iflags.opt_compdup = (int *) 0;
-
for (i = 0; allopt[i].name; i++) {
if (allopt[i].addr)
*(allopt[i].addr) = allopt[i].initval;
}
static boolean
-parse_role_opts(negated, fullname, opts, opp)
+parse_role_opts(optidx, negated, fullname, opts, opp)
+int optidx;
boolean negated;
const char *fullname;
char *opts;
return FALSE;
}
} else {
- if (duplicate_opt_detection(opts, 1))
- complain_about_duplicate(opts, 1);
+ if (duplicate_opt_detection(optidx))
+ complain_about_duplicate(optidx);
*opp = op;
return TRUE;
}