MCPcopy Index your code
hub / github.com/NetHack/NetHack / optfn_alignment

Function optfn_alignment

src/options.c:884–919  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

882 */
883
884staticfn int
885optfn_alignment(
886 int optidx,
887 int req,
888 boolean negated,
889 char *opts,
890 char *op)
891{
892 if (req == do_init) {
893 return optn_ok;
894 }
895 if (req == do_set) {
896 /* alignment:string */
897 if (!parse_role_opt(optidx, negated, allopt[optidx].name, opts, &op))
898 return optn_silenterr;
899
900 if (*op != '!') {
901 if ((flags.initalign = str2align(op)) == ROLE_NONE) {
902 config_error_add("Unknown %s '%s'", allopt[optidx].name, op);
903 return optn_err;
904 }
905 saveoptstr(optidx, rolestring(flags.initalign, aligns, adj));
906 }
907 return optn_ok;
908 }
909 if (req == get_val) {
910 Sprintf(opts, "%s", rolestring(flags.initalign, aligns, adj));
911 return optn_ok;
912 }
913 if (req == get_cnf_val) {
914 op = get_cnf_role_opt(optidx);
915 Strcpy(opts, op ? op : "none");
916 return optn_ok;
917 }
918 return optn_ok;
919}
920
921
922staticfn int

Callers

nothing calls this directly

Calls 5

parse_role_optFunction · 0.85
str2alignFunction · 0.85
config_error_addFunction · 0.85
saveoptstrFunction · 0.85
get_cnf_role_optFunction · 0.85

Tested by

no test coverage detected