tool_in_use()
tool_in_use() [for the '(' and '*' commands] has nothing to do with
the obj->in_use bit, so rename it to tool_being_used().
This commit is contained in:
+10
-7
@@ -1,4 +1,4 @@
|
|||||||
/* 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) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Derek S. Ray, 2015. */
|
/*-Copyright (c) Derek S. Ray, 2015. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -31,7 +31,7 @@ static boolean this_type_only(struct obj *);
|
|||||||
static void dounpaid(void);
|
static void dounpaid(void);
|
||||||
static struct obj *find_unpaid(struct obj *, struct obj **);
|
static struct obj *find_unpaid(struct obj *, struct obj **);
|
||||||
static void menu_identify(int);
|
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_ok(struct obj *);
|
||||||
static int adjust_gold_ok(struct obj *);
|
static int adjust_gold_ok(struct obj *);
|
||||||
static char obj_to_let(struct obj *);
|
static char obj_to_let(struct obj *);
|
||||||
@@ -1082,6 +1082,7 @@ useupall(struct obj *obj)
|
|||||||
obfree(obj, (struct obj *) 0); /* deletes contents also */
|
obfree(obj, (struct obj *) 0); /* deletes contents also */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* an item in inventory is going away after being used */
|
||||||
void
|
void
|
||||||
useup(struct obj *obj)
|
useup(struct obj *obj)
|
||||||
{
|
{
|
||||||
@@ -1099,8 +1100,9 @@ useup(struct obj *obj)
|
|||||||
|
|
||||||
/* use one charge from an item and possibly incur shop debt for it */
|
/* use one charge from an item and possibly incur shop debt for it */
|
||||||
void
|
void
|
||||||
consume_obj_charge(struct obj *obj,
|
consume_obj_charge(
|
||||||
boolean maybe_unpaid) /* false if caller handles shop billing */
|
struct obj *obj,
|
||||||
|
boolean maybe_unpaid) /* false if caller handles shop billing */
|
||||||
{
|
{
|
||||||
if (maybe_unpaid)
|
if (maybe_unpaid)
|
||||||
check_unpaid(obj);
|
check_unpaid(obj);
|
||||||
@@ -3805,8 +3807,9 @@ dopramulet(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* is 'obj' a tool that's in use? can't simply check obj->owornmask */
|
||||||
static boolean
|
static boolean
|
||||||
tool_in_use(struct obj *obj)
|
tool_being_used(struct obj *obj)
|
||||||
{
|
{
|
||||||
if ((obj->owornmask & (W_TOOL | W_SADDLE)) != 0L)
|
if ((obj->owornmask & (W_TOOL | W_SADDLE)) != 0L)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -3825,7 +3828,7 @@ doprtool(void)
|
|||||||
char lets[52 + 1];
|
char lets[52 + 1];
|
||||||
|
|
||||||
for (otmp = g.invent; otmp; otmp = otmp->nobj)
|
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
|
/* we could be carrying more than 52 items; theoretically they
|
||||||
might all be lit candles so avoid potential lets[] overflow */
|
might all be lit candles so avoid potential lets[] overflow */
|
||||||
if (ct >= (int) sizeof lets - 1)
|
if (ct >= (int) sizeof lets - 1)
|
||||||
@@ -3850,7 +3853,7 @@ doprinuse(void)
|
|||||||
char lets[52 + 1];
|
char lets[52 + 1];
|
||||||
|
|
||||||
for (otmp = g.invent; otmp; otmp = otmp->nobj)
|
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
|
/* we could be carrying more than 52 items; theoretically they
|
||||||
might all be lit candles so avoid potential lets[] overflow */
|
might all be lit candles so avoid potential lets[] overflow */
|
||||||
if (ct >= (int) sizeof lets - 1)
|
if (ct >= (int) sizeof lets - 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user