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

Function optfn_gender

src/options.c:1776–1812  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1774}
1775
1776staticfn int
1777optfn_gender(
1778 int optidx,
1779 int req,
1780 boolean negated,
1781 char *opts,
1782 char *op)
1783{
1784 if (req == do_init) {
1785 return optn_ok;
1786 }
1787 if (req == do_set) {
1788 /* gender:string */
1789 if (!parse_role_opt(optidx, negated, allopt[optidx].name, opts, &op))
1790 return optn_silenterr;
1791
1792 if (*op != '!') {
1793 if ((flags.initgend = str2gend(op)) == ROLE_NONE) {
1794 config_error_add("Unknown %s '%s'", allopt[optidx].name, op);
1795 return optn_err;
1796 }
1797 flags.female = flags.initgend;
1798 saveoptstr(optidx, rolestring(flags.initgend, genders, adj));
1799 }
1800 return optn_ok;
1801 }
1802 if (req == get_val) {
1803 Sprintf(opts, "%s", rolestring(flags.initgend, genders, adj));
1804 return optn_ok;
1805 }
1806 if (req == get_cnf_val) {
1807 op = get_cnf_role_opt(optidx);
1808 Strcpy(opts, op ? op : "none");
1809 return optn_ok;
1810 }
1811 return optn_ok;
1812}
1813
1814staticfn int
1815optfn_glyph(

Callers

nothing calls this directly

Calls 5

parse_role_optFunction · 0.85
str2gendFunction · 0.85
config_error_addFunction · 0.85
saveoptstrFunction · 0.85
get_cnf_role_optFunction · 0.85

Tested by

no test coverage detected