some options handling cleanup
Hide 'altkeyhandling' from the 'O' menu for !WIN32 builds. If present in run-time config file it will be parsed and then ignored. Instead of showing "unknown" for the value of the 'hilite_status' compound option, show "none" if there are no highlighting rules, or a pointer to other option "status highlight rules" when there are. Deal with a few function parameters that are used for some combination of build-time config settings and unused for others.
This commit is contained in:
@@ -96,8 +96,13 @@ opt_##a,
|
|||||||
"message window alignment")
|
"message window alignment")
|
||||||
NHOPTC(align_status, 20, opt_in, set_gameview, No, Yes, No, Yes, NoAlias,
|
NHOPTC(align_status, 20, opt_in, set_gameview, No, Yes, No, Yes, NoAlias,
|
||||||
"status window alignment")
|
"status window alignment")
|
||||||
|
#ifdef WIN32
|
||||||
NHOPTC(altkeyhandling, 20, opt_in, set_in_game, No, Yes, No, Yes,
|
NHOPTC(altkeyhandling, 20, opt_in, set_in_game, No, Yes, No, Yes,
|
||||||
"altkeyhandler", "alternative key handling")
|
"altkeyhandler", "alternative key handling")
|
||||||
|
#else
|
||||||
|
NHOPTC(altkeyhandling, 20, opt_in, set_in_config, No, Yes, No, Yes,
|
||||||
|
"altkeyhandler", "(not applicable)")
|
||||||
|
#endif
|
||||||
#ifdef ALTMETA
|
#ifdef ALTMETA
|
||||||
NHOPTB(altmeta, 0, opt_out, set_in_game, Off, Yes, No, No, NoAlias,
|
NHOPTB(altmeta, 0, opt_out, set_in_game, Off, Yes, No, No, NoAlias,
|
||||||
&iflags.altmeta)
|
&iflags.altmeta)
|
||||||
@@ -229,6 +234,9 @@ opt_##a,
|
|||||||
#ifdef STATUS_HILITES
|
#ifdef STATUS_HILITES
|
||||||
NHOPTC(hilite_status, 13, opt_out, set_in_game, Yes, Yes, Yes, No, NoAlias,
|
NHOPTC(hilite_status, 13, opt_out, set_in_game, Yes, Yes, Yes, No, NoAlias,
|
||||||
"a status highlighting rule (can occur multiple times)")
|
"a status highlighting rule (can occur multiple times)")
|
||||||
|
#else
|
||||||
|
NHOPTC(hilite_status, 13, opt_out, set_in_config, Yes, Yes, Yes, No,
|
||||||
|
NoAlias, "(not available)")
|
||||||
#endif
|
#endif
|
||||||
NHOPTB(hitpointbar, 0, opt_in, set_in_game, Off, Yes, No, No, NoAlias,
|
NHOPTB(hitpointbar, 0, opt_in, set_in_game, Off, Yes, No, No, NoAlias,
|
||||||
&iflags.wc2_hitpointbar)
|
&iflags.wc2_hitpointbar)
|
||||||
|
|||||||
@@ -667,8 +667,12 @@ optfn_align_status(int optidx, int req, boolean negated, char *opts, char *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
optfn_altkeyhandling(int optidx UNUSED, int req, boolean negated UNUSED,
|
optfn_altkeyhandling(
|
||||||
char *opts, char *op UNUSED)
|
int optidx UNUSED,
|
||||||
|
int req,
|
||||||
|
boolean negated,
|
||||||
|
char *opts,
|
||||||
|
char *op)
|
||||||
{
|
{
|
||||||
if (req == do_init) {
|
if (req == do_init) {
|
||||||
return optn_ok;
|
return optn_ok;
|
||||||
@@ -677,11 +681,12 @@ optfn_altkeyhandling(int optidx UNUSED, int req, boolean negated UNUSED,
|
|||||||
/* altkeyhandling:string */
|
/* altkeyhandling:string */
|
||||||
|
|
||||||
#if defined(WIN32) && defined(TTY_GRAPHICS)
|
#if defined(WIN32) && defined(TTY_GRAPHICS)
|
||||||
if (op != empty_optstr) {
|
if (op == empty_optstr || negated)
|
||||||
set_altkeyhandling(op);
|
|
||||||
} else {
|
|
||||||
return optn_err;
|
return optn_err;
|
||||||
}
|
set_altkeyhandling(op);
|
||||||
|
#else
|
||||||
|
nhUse(negated);
|
||||||
|
nhUse(op);
|
||||||
#endif
|
#endif
|
||||||
return optn_ok;
|
return optn_ok;
|
||||||
}
|
}
|
||||||
@@ -1276,8 +1281,12 @@ optfn_gender(int optidx, int req, boolean negated, char *opts, char *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
optfn_hilite_status(int optidx UNUSED, int req, boolean negated,
|
optfn_hilite_status(
|
||||||
char *opts, char *op)
|
int optidx UNUSED,
|
||||||
|
int req,
|
||||||
|
boolean negated,
|
||||||
|
char *opts,
|
||||||
|
char *op)
|
||||||
{
|
{
|
||||||
if (req == do_init) {
|
if (req == do_init) {
|
||||||
return optn_ok;
|
return optn_ok;
|
||||||
@@ -1297,6 +1306,8 @@ optfn_hilite_status(int optidx UNUSED, int req, boolean negated,
|
|||||||
return optn_err;
|
return optn_err;
|
||||||
return optn_ok;
|
return optn_ok;
|
||||||
#else
|
#else
|
||||||
|
nhUse(negated);
|
||||||
|
nhUse(op);
|
||||||
config_error_add("'%s' is not supported", allopt[optidx].name);
|
config_error_add("'%s' is not supported", allopt[optidx].name);
|
||||||
return optn_err;
|
return optn_err;
|
||||||
#endif
|
#endif
|
||||||
@@ -1304,7 +1315,13 @@ optfn_hilite_status(int optidx UNUSED, int req, boolean negated,
|
|||||||
if (req == get_val) {
|
if (req == get_val) {
|
||||||
if (!opts)
|
if (!opts)
|
||||||
return optn_err;
|
return optn_err;
|
||||||
|
#ifdef STATUS_HILITES
|
||||||
|
Strcpy(opts, count_status_hilites()
|
||||||
|
? "(see \"status highlight rules\" below)"
|
||||||
|
: "(none)");
|
||||||
|
#else
|
||||||
opts[0] = '\0';
|
opts[0] = '\0';
|
||||||
|
#endif
|
||||||
return optn_ok;
|
return optn_ok;
|
||||||
}
|
}
|
||||||
return optn_ok;
|
return optn_ok;
|
||||||
@@ -3028,23 +3045,27 @@ optfn_sortloot(int optidx, int req, boolean negated UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
optfn_statushilites(int optidx UNUSED, int req, boolean negated,
|
optfn_statushilites(
|
||||||
char *opts, char *op)
|
int optidx UNUSED,
|
||||||
|
int req,
|
||||||
|
boolean negated,
|
||||||
|
char *opts,
|
||||||
|
char *op)
|
||||||
{
|
{
|
||||||
if (req == do_init) {
|
if (req == do_init) {
|
||||||
return optn_ok;
|
return optn_ok;
|
||||||
}
|
}
|
||||||
if (req == do_set) {
|
if (req == do_set) {
|
||||||
/* control over whether highlights should be displayed, and for
|
/* control over whether highlights should be displayed (non-zero), and
|
||||||
* how long */
|
also for how long to show temporary ones (N turns; default 3) */
|
||||||
|
|
||||||
#ifdef STATUS_HILITES
|
#ifdef STATUS_HILITES
|
||||||
if (negated) {
|
if (negated) {
|
||||||
iflags.hilite_delta = 0L;
|
iflags.hilite_delta = 0L;
|
||||||
} else {
|
} else {
|
||||||
op = string_for_opt(opts, TRUE);
|
op = string_for_opt(opts, TRUE);
|
||||||
iflags.hilite_delta =
|
iflags.hilite_delta = (op == empty_optstr || !*op) ? 3L
|
||||||
(op == empty_optstr || !*op) ? 3L : atol(op);
|
: atol(op);
|
||||||
if (iflags.hilite_delta < 0L)
|
if (iflags.hilite_delta < 0L)
|
||||||
iflags.hilite_delta = 1L;
|
iflags.hilite_delta = 1L;
|
||||||
}
|
}
|
||||||
@@ -3052,6 +3073,8 @@ optfn_statushilites(int optidx UNUSED, int req, boolean negated,
|
|||||||
reset_status_hilites();
|
reset_status_hilites();
|
||||||
return optn_ok;
|
return optn_ok;
|
||||||
#else
|
#else
|
||||||
|
nhUse(negated);
|
||||||
|
nhUse(op);
|
||||||
config_error_add("'%s' is not supported", allopt[optidx].name);
|
config_error_add("'%s' is not supported", allopt[optidx].name);
|
||||||
return optn_err;
|
return optn_err;
|
||||||
#endif
|
#endif
|
||||||
@@ -7328,8 +7351,12 @@ optfn_o_status_cond(int optidx UNUSED, int req, boolean negated UNUSED,
|
|||||||
|
|
||||||
#ifdef STATUS_HILITES
|
#ifdef STATUS_HILITES
|
||||||
static int
|
static int
|
||||||
optfn_o_status_hilites(int optidx UNUSED, int req, boolean negated UNUSED,
|
optfn_o_status_hilites(
|
||||||
char *opts, char *op UNUSED)
|
int optidx UNUSED,
|
||||||
|
int req,
|
||||||
|
boolean negated UNUSED,
|
||||||
|
char *opts,
|
||||||
|
char *op UNUSED)
|
||||||
{
|
{
|
||||||
if (req == do_init) {
|
if (req == do_init) {
|
||||||
return optn_ok;
|
return optn_ok;
|
||||||
|
|||||||
Reference in New Issue
Block a user