pull request #809 - just-picked pseudo class and $

Pull request from entrez:  gold wasn't handled consistently when
performing object class filtering with the just-picked-up pseudo
class.

Closes #809
This commit is contained in:
PatR
2022-07-03 16:55:22 -07:00
2 changed files with 19 additions and 21 deletions

View File

@@ -3632,6 +3632,8 @@ tally_BUCX(struct obj *list, boolean by_nexthere,
/* priests always know bless/curse state */
if (Role_if(PM_CLERIC))
list->bknown = (list->oclass != COIN_CLASS);
if (list->pickup_prev)
++(*jcp);
/* coins are either uncursed or unknown based upon option setting */
if (list->oclass == COIN_CLASS) {
if (flags.goldX)
@@ -3640,8 +3642,6 @@ tally_BUCX(struct obj *list, boolean by_nexthere,
++(*ucp);
continue;
}
if (list->pickup_prev)
++(*jcp);
/* ordinary items */
if (!list->bknown)
++(*xcp);
@@ -3795,7 +3795,9 @@ this_type_only(struct obj *obj)
{
boolean res = (obj->oclass == g.this_type);
if (obj->oclass == COIN_CLASS) {
if (g.this_type == 'P') {
res = obj->pickup_prev;
} else if (obj->oclass == COIN_CLASS) {
/* if filtering by bless/curse state, gold is classified as
either unknown or uncursed based on user option setting */
if (g.this_type && index("BUCX", g.this_type))
@@ -3814,9 +3816,6 @@ this_type_only(struct obj *obj)
case 'X':
res = !obj->bknown;
break;
case 'P':
res = obj->pickup_prev;
break;
default:
break; /* use 'res' as-is */
}

View File

@@ -459,20 +459,9 @@ allow_category(struct obj *obj)
/* For coins, if any class filter is specified, accept if coins
* are included regardless of whether either unpaid or BUC-status
* is also specified since player has explicitly requested coins.
* If no class filtering is specified but bless/curse state is,
* coins are either unknown or uncursed based on an option setting.
*/
if (obj->oclass == COIN_CLASS)
return g.class_filter
? (index(g.valid_menu_classes, COIN_CLASS) ? TRUE : FALSE)
: g.shop_filter /* coins are never unpaid, but check anyway */
? (obj->unpaid ? TRUE : FALSE)
: g.picked_filter
? obj->pickup_prev
: g.bucx_filter
? (index(g.valid_menu_classes, flags.goldX ? 'X' : 'U')
? TRUE : FALSE)
: TRUE; /* catchall: no filters specified, so accept */
if (obj->oclass == COIN_CLASS && g.class_filter)
return index(g.valid_menu_classes, COIN_CLASS) ? TRUE : FALSE;
if (Role_if(PM_CLERIC) && !obj->bknown)
set_bknown(obj, 1);
@@ -505,8 +494,18 @@ allow_category(struct obj *obj)
/* check for particular bless/curse state */
if (g.bucx_filter) {
/* first categorize this object's bless/curse state */
char bucx = !obj->bknown ? 'X'
: obj->blessed ? 'B' : obj->cursed ? 'C' : 'U';
char bucx;
if (obj->oclass == COIN_CLASS) {
/* If no class filtering is specified but bless/curse state is,
coins are treated as either unknown or uncursed based on an
option setting. */
bucx = flags.goldX ? 'X' : 'U';
} else {
bucx = !obj->bknown ? 'X'
: obj->blessed ? 'B'
: obj->cursed ? 'C'
: 'U';
}
/* if its category is not in the list, reject */
if (!index(g.valid_menu_classes, bucx))