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

Function optfn_race

src/options.c:3506–3542  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3504}
3505
3506staticfn int
3507optfn_race(
3508 int optidx,
3509 int req,
3510 boolean negated,
3511 char *opts,
3512 char *op)
3513{
3514 if (req == do_init) {
3515 return optn_ok;
3516 }
3517 if (req == do_set) {
3518 /* race:string */
3519 if (!parse_role_opt(optidx, negated, allopt[optidx].name, opts, &op))
3520 return optn_silenterr;
3521
3522 if (*op != '!') {
3523 if ((flags.initrace = str2race(op)) == ROLE_NONE) {
3524 config_error_add("Unknown %s '%s'", allopt[optidx].name, op);
3525 return optn_err;
3526 }
3527 gp.pl_race = *op; /* Backwards compatibility */
3528 saveoptstr(optidx, rolestring(flags.initrace, races, noun));
3529 }
3530 return optn_ok;
3531 }
3532 if (req == get_val) {
3533 Sprintf(opts, "%s", rolestring(flags.initrace, races, noun));
3534 return optn_ok;
3535 }
3536 if (req == get_cnf_val) {
3537 op = get_cnf_role_opt(optidx);
3538 Strcpy(opts, op ? op : "none");
3539 return optn_ok;
3540 }
3541 return optn_ok;
3542}
3543
3544staticfn int
3545optfn_roguesymset(

Callers

nothing calls this directly

Calls 5

parse_role_optFunction · 0.85
str2raceFunction · 0.85
config_error_addFunction · 0.85
saveoptstrFunction · 0.85
get_cnf_role_optFunction · 0.85

Tested by

no test coverage detected