-/* NetHack 3.6 extern.h $NHDT-Date: 1544998887 2018/12/16 22:21:27 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.671 $ */
+/* NetHack 3.6 extern.h $NHDT-Date: 1545036280 2018/12/17 08:44:40 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.672 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
E struct obj *NDECL(u_have_novel);
E struct obj *FDECL(o_on, (unsigned int, struct obj *));
E boolean FDECL(obj_here, (struct obj *, int, int));
+E int FDECL(ckunpaid, (struct obj *));
E boolean NDECL(wearing_armor);
E boolean FDECL(is_worn, (struct obj *));
E struct obj *FDECL(g_at, (int, int));
-/* NetHack 3.6 do.c $NHDT-Date: 1545005168 2018/12/17 00:06:08 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.179 $ */
+/* NetHack 3.6 do.c $NHDT-Date: 1545036287 2018/12/17 08:44:47 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.180 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
/* doname can call s_suffix, reusing its buffer */
Strcpy(monbuf, s_suffix(mon_nam(u.ustuck)));
- onam_p = obj->unpaid ? yobjnam(obj, (char *) 0) : doname(obj);
-
+ onam_p = ckunpaid(obj) ? yobjnam(obj, (char *) 0) : doname(obj);
You("drop %s into %s %s.", onam_p, monbuf,
mbodypart(u.ustuck, STOMACH));
}
could_grow = (obj->corpsenm == PM_WRAITH);
could_heal = (obj->corpsenm == PM_NURSE);
}
- if (obj->unpaid)
+ if (ckunpaid(obj))
(void) stolen_value(obj, u.ux, u.uy, TRUE, FALSE);
(void) mpickobj(u.ustuck, obj);
if (is_animal(u.ustuck->data)) {
-/* NetHack 3.6 invent.c $NHDT-Date: 1541145517 2018/11/02 07:58:37 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.241 $ */
+/* NetHack 3.6 invent.c $NHDT-Date: 1545036289 2018/12/17 08:44:49 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.243 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
STATIC_DCL void FDECL(compactify, (char *));
STATIC_DCL boolean FDECL(taking_off, (const char *));
STATIC_DCL boolean FDECL(putting_on, (const char *));
-STATIC_PTR int FDECL(ckunpaid, (struct obj *));
STATIC_PTR int FDECL(ckvalidcat, (struct obj *));
STATIC_PTR char *FDECL(safeq_xprname, (struct obj *));
STATIC_PTR char *FDECL(safeq_shortxprname, (struct obj *));
return (int) allow_category(otmp);
}
-STATIC_PTR int
+int
ckunpaid(otmp)
struct obj *otmp;
{
-/* NetHack 3.6 shk.c $NHDT-Date: 1542853899 2018/11/22 02:31:39 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.142 $ */
+/* NetHack 3.6 shk.c $NHDT-Date: 1545036290 2018/12/17 08:44:50 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.143 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
char roomno = *in_rooms(x, y, SHOPBASE);
struct bill_x *bp;
struct monst *shkp = 0;
+ boolean was_unpaid;
+ long c_count = 0L, u_count = 0L;
+
+ /* gather information for message(s) prior to manipulating bill */
+ was_unpaid = obj->unpaid ? TRUE : FALSE;
+ if (Has_contents(obj)) {
+ c_count = count_contents(obj, TRUE, FALSE, TRUE);
+ u_count = count_contents(obj, TRUE, FALSE, FALSE);
+ }
if (!billable(&shkp, obj, roomno, FALSE)) {
/* things already on the bill yield a not-billable result, so
ESHK(shkp)->debit += value;
if (!silent) {
+ char buf[BUFSZ];
const char *still = "";
if (credit_use) {
}
still = "still ";
}
- if (obj->oclass == COIN_CLASS)
- You("%sowe %s %ld %s!", still, shkname(shkp), value,
- currency(value));
- else
- You("%sowe %s %ld %s for %s!", still, shkname(shkp),
- value, currency(value), (obj->quan > 1L) ? "them" : "it");
+ Sprintf(buf, "%sowe %s %ld %s", still, shkname(shkp),
+ value, currency(value));
+ if (u_count) /* u_count > 0 implies Has_contents(obj) */
+ Sprintf(eos(buf), " for %s%sits contents",
+ was_unpaid ? "it and " : "",
+ (c_count > u_count) ? "some of " : "");
+ else if (obj->oclass != COIN_CLASS)
+ Sprintf(eos(buf), " for %s",
+ (obj->quan > 1L) ? "them" : "it");
+
+ You("%s!", buf); /* "You owe <shk> N zorkmids for it!" */
}
} else {
ESHK(shkp)->robbed += value;