-/* NetHack 3.7 invent.c $NHDT-Date: 1625969349 2021/07/11 02:09:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.334 $ */
+/* NetHack 3.7 invent.c $NHDT-Date: 1629408035 2021/08/19 21:20:35 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.338 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
static void dounpaid(void);
static struct obj *find_unpaid(struct obj *, struct obj **);
static void menu_identify(int);
-static boolean tool_in_use(struct obj *);
+static boolean tool_being_used(struct obj *);
static int adjust_ok(struct obj *);
static int adjust_gold_ok(struct obj *);
static char obj_to_let(struct obj *);
obfree(obj, (struct obj *) 0); /* deletes contents also */
}
+/* an item in inventory is going away after being used */
void
useup(struct obj *obj)
{
/* use one charge from an item and possibly incur shop debt for it */
void
-consume_obj_charge(struct obj *obj,
- boolean maybe_unpaid) /* false if caller handles shop billing */
+consume_obj_charge(
+ struct obj *obj,
+ boolean maybe_unpaid) /* false if caller handles shop billing */
{
if (maybe_unpaid)
check_unpaid(obj);
return 0;
}
+/* is 'obj' a tool that's in use? can't simply check obj->owornmask */
static boolean
-tool_in_use(struct obj *obj)
+tool_being_used(struct obj *obj)
{
if ((obj->owornmask & (W_TOOL | W_SADDLE)) != 0L)
return TRUE;
char lets[52 + 1];
for (otmp = g.invent; otmp; otmp = otmp->nobj)
- if (tool_in_use(otmp)) {
+ if (tool_being_used(otmp)) {
/* we could be carrying more than 52 items; theoretically they
might all be lit candles so avoid potential lets[] overflow */
if (ct >= (int) sizeof lets - 1)
char lets[52 + 1];
for (otmp = g.invent; otmp; otmp = otmp->nobj)
- if (is_worn(otmp) || tool_in_use(otmp)) {
+ if (is_worn(otmp) || tool_being_used(otmp)) {
/* we could be carrying more than 52 items; theoretically they
might all be lit candles so avoid potential lets[] overflow */
if (ct >= (int) sizeof lets - 1)