drink_ok() tweak

Fix a comment typo and change the 'if obj/!obj' logic to be like what
was recently added to eat_ok()/offer_ok()/tin_ok().
This commit is contained in:
PatR
2022-04-17 01:39:34 -07:00
parent 52cfe40d33
commit ec4749914a
+7 -7
View File
@@ -500,18 +500,18 @@ ghost_from_bottle(void)
static int static int
drink_ok(struct obj *obj) drink_ok(struct obj *obj)
{ {
if (obj && obj->oclass == POTION_CLASS)
return GETOBJ_SUGGEST;
/* getobj()'s callback to test whether hands/self is a valid "item" to /* getobj()'s callback to test whether hands/self is a valid "item" to
pick is used here to communicate the fact that player has already pick is used here to communicate the fact that player has already
passed up an opportunity to perform the action (drink or dip) on a passed up an opportunity to perform the action (drink or dip) on a
non-inventory dungeon feature, so if there are no potions in invent non-inventory dungeon feature, so if there are no potions in invent
the message will be "you have nothing /else/ to {drink | dip into}"; the message will be "you have nothing /else/ to {drink | dip into}";
if player used 'm' prefix to bypass dungeon features, drink_ok_extra if player used 'm' prefix to bypass dungeon features, drink_ok_extra
will be 0 and the potential "else" will omitted */ will be 0 and the potential "else" will be omitted */
if (!obj && drink_ok_extra) if (!obj)
return GETOBJ_EXCLUDE_NONINVENT; return drink_ok_extra ? GETOBJ_EXCLUDE_NONINVENT : GETOBJ_EXCLUDE;
if (obj->oclass == POTION_CLASS)
return GETOBJ_SUGGEST;
return GETOBJ_EXCLUDE; return GETOBJ_EXCLUDE;
} }
@@ -1065,7 +1065,7 @@ peffect_gain_level(struct obj *otmp)
/* they went up a level */ /* they went up a level */
if ((ledger_no(&u.uz) == 1 && u.uhave.amulet) if ((ledger_no(&u.uz) == 1 && u.uhave.amulet)
|| Can_rise_up(u.ux, u.uy, &u.uz)) { || Can_rise_up(u.ux, u.uy, &u.uz)) {
static const char *riseup = "rise up, through the %s!"; static const char riseup[] = "rise up, through the %s!";
if (ledger_no(&u.uz) == 1) { if (ledger_no(&u.uz) == 1) {
You(riseup, ceiling(u.ux, u.uy)); You(riseup, ceiling(u.ux, u.uy));