From: nethack.allison Date: Tue, 19 Feb 2002 14:20:21 +0000 (+0000) Subject: More BUC X-Git-Tag: MOVE2GIT~3152 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4170c75993c54d3ddcd596abe3a13201c4b4cd74;p=nethack More BUC Defer to the validation code from pickup.c for checking valid categories. This reduces the number of callback functions required, and allows combinations of BUCX to be used in traditional menu style. --- diff --git a/src/invent.c b/src/invent.c index 5fa211ce2..bfc273fa2 100644 --- a/src/invent.c +++ b/src/invent.c @@ -17,10 +17,7 @@ STATIC_DCL boolean FDECL(only_here, (struct obj *)); #endif /* OVL1 */ STATIC_DCL void FDECL(compactify,(char *)); STATIC_PTR int FDECL(ckunpaid,(struct obj *)); -STATIC_PTR int FDECL(ckblessed,(struct obj *)); -STATIC_PTR int FDECL(ckuncursed,(struct obj *)); -STATIC_PTR int FDECL(ckcursed,(struct obj *)); -STATIC_PTR int FDECL(ckunbknown,(struct obj *)); +STATIC_PTR int FDECL(ckvalidcat,(struct obj *)); static char FDECL(display_pickinv, (const char *,BOOLEAN_P, long *)); #ifdef OVLB STATIC_DCL boolean FDECL(this_type_only, (struct obj *)); @@ -1039,38 +1036,18 @@ register const char *let,*word; #ifdef OVLB STATIC_PTR int -ckunpaid(otmp) -register struct obj *otmp; -{ - return((int)(otmp->unpaid)); -} - -STATIC_PTR int -ckblessed(otmp) +ckvalidcat(otmp) register struct obj *otmp; { - return((int)(otmp->bknown && otmp->blessed)); + /* use allow_category() from pickup.c */ + return((int)allow_category(otmp)); } STATIC_PTR int -ckuncursed(otmp) -register struct obj *otmp; -{ - return((int)(otmp->bknown && !otmp->blessed && !otmp->cursed)); -} - -STATIC_PTR int -ckcursed(otmp) -register struct obj *otmp; -{ - return((int)(otmp->bknown && otmp->cursed)); -} - -STATIC_PTR int -ckunbknown(otmp) +ckunpaid(otmp) register struct obj *otmp; { - return((int)(!otmp->bknown)); + return((int)(otmp->unpaid)); } boolean @@ -1224,16 +1201,16 @@ unsigned *resultflags; ckfn = ckunpaid; } else if (sym == 'B') { add_valid_menu_class('B'); - ckfn = ckblessed; + ckfn = ckvalidcat; } else if (sym == 'U') { add_valid_menu_class('U'); - ckfn = ckuncursed; + ckfn = ckvalidcat; } else if (sym == 'C') { add_valid_menu_class('C'); - ckfn = ckcursed; + ckfn = ckvalidcat; } else if (sym == 'X') { add_valid_menu_class('X'); - ckfn = ckunbknown; + ckfn = ckvalidcat; } else if (sym == 'm') { m_seen = TRUE; } else if (oc_of_sym == MAXOCLASSES) {