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:
11
src/invent.c
11
src/invent.c
@@ -3632,6 +3632,8 @@ tally_BUCX(struct obj *list, boolean by_nexthere,
|
|||||||
/* priests always know bless/curse state */
|
/* priests always know bless/curse state */
|
||||||
if (Role_if(PM_CLERIC))
|
if (Role_if(PM_CLERIC))
|
||||||
list->bknown = (list->oclass != COIN_CLASS);
|
list->bknown = (list->oclass != COIN_CLASS);
|
||||||
|
if (list->pickup_prev)
|
||||||
|
++(*jcp);
|
||||||
/* coins are either uncursed or unknown based upon option setting */
|
/* coins are either uncursed or unknown based upon option setting */
|
||||||
if (list->oclass == COIN_CLASS) {
|
if (list->oclass == COIN_CLASS) {
|
||||||
if (flags.goldX)
|
if (flags.goldX)
|
||||||
@@ -3640,8 +3642,6 @@ tally_BUCX(struct obj *list, boolean by_nexthere,
|
|||||||
++(*ucp);
|
++(*ucp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (list->pickup_prev)
|
|
||||||
++(*jcp);
|
|
||||||
/* ordinary items */
|
/* ordinary items */
|
||||||
if (!list->bknown)
|
if (!list->bknown)
|
||||||
++(*xcp);
|
++(*xcp);
|
||||||
@@ -3795,7 +3795,9 @@ this_type_only(struct obj *obj)
|
|||||||
{
|
{
|
||||||
boolean res = (obj->oclass == g.this_type);
|
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
|
/* if filtering by bless/curse state, gold is classified as
|
||||||
either unknown or uncursed based on user option setting */
|
either unknown or uncursed based on user option setting */
|
||||||
if (g.this_type && index("BUCX", g.this_type))
|
if (g.this_type && index("BUCX", g.this_type))
|
||||||
@@ -3814,9 +3816,6 @@ this_type_only(struct obj *obj)
|
|||||||
case 'X':
|
case 'X':
|
||||||
res = !obj->bknown;
|
res = !obj->bknown;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
|
||||||
res = obj->pickup_prev;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break; /* use 'res' as-is */
|
break; /* use 'res' as-is */
|
||||||
}
|
}
|
||||||
|
|||||||
29
src/pickup.c
29
src/pickup.c
@@ -459,20 +459,9 @@ allow_category(struct obj *obj)
|
|||||||
/* For coins, if any class filter is specified, accept if coins
|
/* For coins, if any class filter is specified, accept if coins
|
||||||
* are included regardless of whether either unpaid or BUC-status
|
* are included regardless of whether either unpaid or BUC-status
|
||||||
* is also specified since player has explicitly requested coins.
|
* 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)
|
if (obj->oclass == COIN_CLASS && g.class_filter)
|
||||||
return g.class_filter
|
return index(g.valid_menu_classes, COIN_CLASS) ? TRUE : FALSE;
|
||||||
? (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 (Role_if(PM_CLERIC) && !obj->bknown)
|
if (Role_if(PM_CLERIC) && !obj->bknown)
|
||||||
set_bknown(obj, 1);
|
set_bknown(obj, 1);
|
||||||
@@ -505,8 +494,18 @@ allow_category(struct obj *obj)
|
|||||||
/* check for particular bless/curse state */
|
/* check for particular bless/curse state */
|
||||||
if (g.bucx_filter) {
|
if (g.bucx_filter) {
|
||||||
/* first categorize this object's bless/curse state */
|
/* first categorize this object's bless/curse state */
|
||||||
char bucx = !obj->bknown ? 'X'
|
char bucx;
|
||||||
: obj->blessed ? 'B' : obj->cursed ? 'C' : 'U';
|
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 its category is not in the list, reject */
|
||||||
if (!index(g.valid_menu_classes, bucx))
|
if (!index(g.valid_menu_classes, bucx))
|
||||||
|
|||||||
Reference in New Issue
Block a user