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

Function optfn_sortdiscoveries

src/options.c:3862–3911  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3860}
3861
3862staticfn int
3863optfn_sortdiscoveries(
3864 int optidx, int req, boolean negated,
3865 char *opts, char *op)
3866{
3867 if (req == do_init) {
3868 flags.discosort = 'o';
3869 return optn_ok;
3870 }
3871 if (req == do_set) {
3872 op = string_for_env_opt(allopt[optidx].name, opts, FALSE);
3873 if (negated) {
3874 flags.discosort = 'o';
3875 } else if (op != empty_optstr) {
3876 switch (lowc(*op)) {
3877 case '0':
3878 case 'o': /* order of discovery */
3879 flags.discosort = 'o';
3880 break;
3881 case '1':
3882 case 's': /* sortloot order (subclasses for some classes) */
3883 flags.discosort = 's';
3884 break;
3885 case '2':
3886 case 'c': /* alphabetical within each class */
3887 flags.discosort = 'c';
3888 break;
3889 case '3':
3890 case 'a': /* alphabetical across all classes */
3891 flags.discosort = 'a';
3892 break;
3893 default:
3894 config_error_add("Unknown %s parameter '%s'",
3895 allopt[optidx].name, op);
3896 return optn_silenterr;
3897 }
3898 } else
3899 return optn_err;
3900 return optn_ok;
3901 }
3902 if (req == get_val || req == get_cnf_val) {
3903 get_sortdisco(opts, (req == get_cnf_val) ? TRUE : FALSE);
3904 return optn_ok;
3905 }
3906 if (req == do_handler) {
3907 /* return handler_sortdiscoveries(); */
3908 (void) choose_disco_sort(0); /* o_init.c */
3909 }
3910 return optn_ok;
3911}
3912
3913staticfn int
3914optfn_sortloot(

Callers

nothing calls this directly

Calls 5

string_for_env_optFunction · 0.85
config_error_addFunction · 0.85
get_sortdiscoFunction · 0.85
choose_disco_sortFunction · 0.85
lowcFunction · 0.70

Tested by

no test coverage detected