MCPcopy Create free account
hub / github.com/NetHack/NetHack / optfn_statushilites

Function optfn_statushilites

src/options.c:4012–4064  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4010}
4011
4012staticfn int
4013optfn_statushilites(
4014 int optidx UNUSED, int req, boolean negated,
4015 char *opts, char *op)
4016{
4017 if (req == do_init) {
4018 return optn_ok;
4019 }
4020 if (req == do_set) {
4021 /* control over whether highlights should be displayed (non-zero), and
4022 also for how long to show temporary ones (N turns; default 3) */
4023
4024#ifdef STATUS_HILITES
4025 if (negated) {
4026 iflags.hilite_delta = 0L;
4027 } else {
4028 op = string_for_opt(opts, TRUE);
4029 iflags.hilite_delta = (op == empty_optstr || !*op) ? 3L
4030 : atol(op);
4031 if (iflags.hilite_delta < 0L)
4032 iflags.hilite_delta = 1L;
4033 }
4034 if (!go.opt_from_file)
4035 reset_status_hilites();
4036 return optn_ok;
4037#else
4038 nhUse(negated);
4039 nhUse(op);
4040 config_error_add("'%s' is not supported", allopt[optidx].name);
4041 return optn_err;
4042#endif
4043 }
4044 if (req == get_val) {
4045#ifdef STATUS_HILITES
4046 if (!iflags.hilite_delta)
4047 Strcpy(opts, "0 (off: don't highlight status fields)");
4048 else
4049 Sprintf(opts, "%ld (on: highlight status for %ld turns)",
4050 iflags.hilite_delta, iflags.hilite_delta);
4051#else
4052 Strcpy(opts, "unsupported");
4053#endif
4054 return optn_ok;
4055 }
4056 if (req == get_cnf_val) {
4057#ifdef STATUS_HILITES
4058 Sprintf(opts, "%ld", iflags.hilite_delta);
4059#else
4060 opts[0] = '\0';
4061#endif
4062 }
4063 return optn_ok;
4064}
4065
4066staticfn int
4067optfn_statuslines(

Callers

nothing calls this directly

Calls 3

string_for_optFunction · 0.85
reset_status_hilitesFunction · 0.85
config_error_addFunction · 0.85

Tested by

no test coverage detected