better testing for is_potion (should be a function)

This commit is contained in:
Enno Rehling 2018-01-12 10:06:13 +01:00
parent 4ef7009de7
commit 4d38a40e96
1 changed files with 6 additions and 5 deletions

View File

@ -2417,10 +2417,10 @@ static void reshow_other(unit * u, struct order *ord, const char *s) {
int i = i_get(u->items, itype); int i = i_get(u->items, itype);
err = 36; /* we do not have this item? */ err = 36; /* we do not have this item? */
if (i <= 0) { if (i <= 0 && (itype->flags & ITF_POTION)) {
/* we don't have the item, but it may be a potion that we know */ /* we don't have the item, but it is a potion. do we know it? */
int level = potion_level(itype); int level = potion_level(itype);
if (2 * level > effskill(u, SK_ALCHEMY, 0)) { if (level > 0 && 2 * level > effskill(u, SK_ALCHEMY, 0)) {
itype = NULL; itype = NULL;
} }
} }
@ -2452,8 +2452,9 @@ static void reshow_other(unit * u, struct order *ord, const char *s) {
found = true; found = true;
} }
} }
if (!found) if (!found) {
cmistake(u, ord, err, MSG_EVENT); cmistake(u, ord, err, MSG_EVENT);
}
} }
static void reshow(unit * u, struct order *ord, const char *s, param_t p) static void reshow(unit * u, struct order *ord, const char *s, param_t p)