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

Function optfn_sortloot

src/options.c:3913–3955  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3911}
3912
3913staticfn int
3914optfn_sortloot(
3915 int optidx, int req, boolean negated UNUSED,
3916 char *opts, char *op)
3917{
3918 int i;
3919
3920 if (req == do_init) {
3921 return optn_ok;
3922 }
3923 if (req == do_set) {
3924 op = string_for_env_opt(allopt[optidx].name, opts, FALSE);
3925 if (op != empty_optstr) {
3926 char c = lowc(*op);
3927
3928 switch (c) {
3929 case 'n': /* none */
3930 case 'l': /* loot (pickup) */
3931 case 'f': /* full (pickup + invent) */
3932 flags.sortloot = c;
3933 break;
3934 default:
3935 config_error_add("Unknown %s parameter '%s'",
3936 allopt[optidx].name, op);
3937 return optn_err;
3938 }
3939 } else
3940 return optn_err;
3941 return optn_ok;
3942 }
3943 if (req == get_val || req == get_cnf_val) {
3944 for (i = 0; i < SIZE(sortltype); i++)
3945 if (flags.sortloot == sortltype[i][0]) {
3946 Strcpy(opts, sortltype[i]);
3947 break;
3948 }
3949 return optn_ok;
3950 }
3951 if (req == do_handler) {
3952 return handler_sortloot();
3953 }
3954 return optn_ok;
3955}
3956
3957staticfn int
3958optfn_sortvanquished(

Callers

nothing calls this directly

Calls 4

string_for_env_optFunction · 0.85
config_error_addFunction · 0.85
handler_sortlootFunction · 0.85
lowcFunction · 0.70

Tested by

no test coverage detected