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

Function optfn_playmode

src/options.c:3470–3504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3468}
3469
3470staticfn int
3471optfn_playmode(
3472 int optidx, int req, boolean negated,
3473 char *opts, char *op)
3474{
3475 if (req == do_init) {
3476 return optn_ok;
3477 }
3478 if (req == do_set) {
3479 /* play mode: normal, explore/discovery, or debug/wizard */
3480
3481 if (duplicate || negated)
3482 return optn_err;
3483 if (op == empty_optstr)
3484 return optn_err;
3485 if (!strncmpi(op, "normal", 6) || !strcmpi(op, "play")) {
3486 wizard = discover = FALSE;
3487 } else if (!strncmpi(op, "explore", 6)
3488 || !strncmpi(op, "discovery", 6)) {
3489 wizard = FALSE, discover = TRUE;
3490 } else if (!strncmpi(op, "debug", 5) || !strncmpi(op, "wizard", 6)) {
3491 wizard = TRUE, discover = FALSE;
3492 } else {
3493 config_error_add("Invalid value for \"%s\":%s",
3494 allopt[optidx].name, op);
3495 return optn_err;
3496 }
3497 return optn_ok;
3498 }
3499 if (req == get_val || req == get_cnf_val) {
3500 Strcpy(opts, wizard ? "debug" : discover ? "explore" : "normal");
3501 return optn_ok;
3502 }
3503 return optn_ok;
3504}
3505
3506staticfn int
3507optfn_race(

Callers

nothing calls this directly

Calls 2

config_error_addFunction · 0.85
strncmpiFunction · 0.70

Tested by

no test coverage detected