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

Function optfn_whatis_coord

src/options.c:4702–4745  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4700}
4701
4702staticfn int
4703optfn_whatis_coord(
4704 int optidx, int req, boolean negated,
4705 char *opts, char *op)
4706{
4707 if (req == do_init) {
4708 return optn_ok;
4709 }
4710 if (req == do_set) {
4711 if (negated) {
4712 iflags.getpos_coords = GPCOORDS_NONE;
4713 return optn_ok;
4714 } else if ((op = string_for_env_opt(allopt[optidx].name, opts, FALSE))
4715 != empty_optstr) {
4716 static char gpcoords[] = { GPCOORDS_NONE, GPCOORDS_COMPASS,
4717 GPCOORDS_COMFULL, GPCOORDS_MAP,
4718 GPCOORDS_SCREEN, '\0' };
4719 char c = lowc(*op);
4720
4721 if (c && strchr(gpcoords, c))
4722 iflags.getpos_coords = c;
4723 else {
4724 config_error_add("Unknown %s parameter '%s'",
4725 allopt[optidx].name, op);
4726 return optn_err;
4727 }
4728 } else
4729 return optn_err;
4730 return optn_ok;
4731 }
4732 if (req == get_val || req == get_cnf_val) {
4733 Sprintf(opts, "%s",
4734 (iflags.getpos_coords == GPCOORDS_MAP) ? "map"
4735 : (iflags.getpos_coords == GPCOORDS_COMPASS) ? "compass"
4736 : (iflags.getpos_coords == GPCOORDS_COMFULL) ? "full compass"
4737 : (iflags.getpos_coords == GPCOORDS_SCREEN) ? "screen"
4738 : "none");
4739 return optn_ok;
4740 }
4741 if (req == do_handler) {
4742 return handler_whatis_coord();
4743 }
4744 return optn_ok;
4745}
4746
4747staticfn int
4748optfn_whatis_filter(

Callers

nothing calls this directly

Calls 4

string_for_env_optFunction · 0.85
config_error_addFunction · 0.85
handler_whatis_coordFunction · 0.85
lowcFunction · 0.70

Tested by

no test coverage detected