fall into water or lava instead of remaining on top
don't give a speed change message when an immobile monster is seen to be hit
by a wand of speed or slow monster
+when shopkeeper "gratefully inherits possessions" of hero who dies in shop
+ doorway without owing the shop, move those items inside shop for bones
+dying in a shop while wielding two weapons could cause "Setworn: mask" warning
Platform- and/or Interface-Specific Fixes
/* ### bones.c ### */
+E void FDECL(drop_upon_death, (struct monst *,struct obj *,int,int));
E boolean NDECL(can_make_bones);
E void FDECL(savebones, (struct obj *));
E int NDECL(getbones);
-/* SCCS Id: @(#)bones.c 3.5 2006/04/14 */
+/* SCCS Id: @(#)bones.c 3.5 2007/03/01 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985,1993. */
/* NetHack may be freely redistributed. See license for details. */
STATIC_DCL boolean FDECL(no_bones_level, (d_level *));
STATIC_DCL void FDECL(goodfruit, (int));
STATIC_DCL void FDECL(resetobjs,(struct obj *,BOOLEAN_P));
-STATIC_DCL void FDECL(drop_upon_death, (struct monst *, struct obj *));
STATIC_OVL boolean
no_bones_level(lev)
}
}
-STATIC_OVL void
-drop_upon_death(mtmp, cont)
+/* called by savebones(); also by finish_paybill(shk.c) */
+void
+drop_upon_death(mtmp, cont, x, y)
struct monst *mtmp;
struct obj *cont;
+int x, y;
{
struct obj *otmp;
- uswapwep = 0; /* ensure curse() won't cause swapwep to drop twice */
+ u.twoweap = 0; /* ensure curse() won't cause swapwep to drop twice */
while ((otmp = invent) != 0) {
obj_extract_self(otmp);
obj_no_longer_held(otmp);
else if (cont)
(void) add_to_container(cont, otmp);
else
- place_object(otmp, u.ux, u.uy);
+ place_object(otmp, x, y);
}
#ifndef GOLDOBJ
if(u.ugold) {
long ugold = u.ugold;
+
if (mtmp) mtmp->mgold = ugold;
else if (cont) (void) add_to_container(cont, mkgoldobj(ugold));
- else (void)mkgold(ugold, u.ux, u.uy);
+ else (void)mkgold(ugold, x, y);
u.ugold = ugold; /* undo mkgoldobj()'s removal */
}
#endif
otmp = mk_named_object(STATUE, &mons[u.umonnum],
u.ux, u.uy, plname);
- drop_upon_death((struct monst *)0, otmp);
+ drop_upon_death((struct monst *)0, otmp, u.ux, u.uy);
if (!otmp) return; /* couldn't make statue */
mtmp = (struct monst *)0;
} else if (u.ugrave_arise < LOW_PM) {
/* drop everything */
- drop_upon_death((struct monst *)0, (struct obj *)0);
+ drop_upon_death((struct monst *)0, (struct obj *)0, u.ux, u.uy);
/* trick makemon() into allowing monster creation
* on your location
*/
mtmp = makemon(&mons[u.ugrave_arise], u.ux, u.uy, NO_MM_FLAGS);
in_mklev = FALSE;
if (!mtmp) {
- drop_upon_death((struct monst *)0, (struct obj *)0);
+ drop_upon_death((struct monst *)0, (struct obj *)0,
+ u.ux, u.uy);
return;
}
mtmp = christen_monst(mtmp, plname);
Your("body rises from the dead as %s...",
an(mons[u.ugrave_arise].mname));
display_nhwindow(WIN_MESSAGE, FALSE);
- drop_upon_death(mtmp, (struct obj *)0);
+ drop_upon_death(mtmp, (struct obj *)0, u.ux, u.uy);
m_dowear(mtmp, TRUE);
}
if (mtmp) {
-/* SCCS Id: @(#)shk.c 3.5 2006/10/30 */
+/* SCCS Id: @(#)shk.c 3.5 2007/03/01 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
(struct monst *,struct obj *,const char *,long,const char *));
STATIC_DCL struct obj *FDECL(bp_to_obj, (struct bill_x *));
STATIC_DCL boolean FDECL(inherits, (struct monst *,int,int));
-STATIC_DCL void FDECL(set_repo_loc, (struct eshk *));
+STATIC_DCL void FDECL(set_repo_loc, (struct monst *));
STATIC_DCL boolean NDECL(angry_shk_exists);
STATIC_DCL void FDECL(rile_shk, (struct monst *));
STATIC_DCL void FDECL(rouse_shk, (struct monst *,BOOLEAN_P));
return buy;
}
-static coord repo_location; /* repossession context */
+static struct repo { /* repossession context */
+ struct monst *shopkeeper;
+ coord location;
+} repo;
/* routine called after dying (or quitting) */
boolean
shops don't occur on level 1, but this could happen if hero
level teleports out of the dungeon and manages not to die */
if (croaked < 0) return FALSE;
+ /* [should probably also return false when dead hero has been
+ petrified since shk shouldn't be able to grab inventory
+ which has been shut inside a statue] */
/* this is where inventory will end up if any shk takes it */
- repo_location.x = repo_location.y = 0;
+ repo.location.x = repo.location.y = 0;
+ repo.shopkeeper = 0;
/* give shopkeeper first crack */
if ((mtmp = shop_keeper(*u.ushops)) && inhishop(mtmp)) {
if(roomno == eshkp->shoproom && inhishop(shkp) &&
!eshkp->billct && !eshkp->robbed && !eshkp->debit &&
NOTANGRY(shkp) && !eshkp->following) {
- if (invent)
+ taken = (invent != 0);
+ if (taken)
pline("%s gratefully inherits all your possessions.",
shkname(shkp));
- set_repo_loc(eshkp);
+ set_repo_loc(shkp);
goto clear;
}
shkname(shkp), takes);
taken = TRUE;
/* where to put player's invent (after disclosure) */
- set_repo_loc(eshkp);
+ set_repo_loc(shkp);
} else {
#ifndef GOLDOBJ
shkp->mgold += loss;
}
STATIC_OVL void
-set_repo_loc(eshkp)
-struct eshk *eshkp;
+set_repo_loc(shkp)
+struct monst *shkp;
{
register xchar ox, oy;
+ struct eshk *eshkp = ESHK(shkp);
/* if you're not in this shk's shop room, or if you're in its doorway
or entry spot, then your gear gets dumped all the way inside */
oy = u.uy;
}
/* finish_paybill will deposit invent here */
- repo_location.x = ox;
- repo_location.y = oy;
+ repo.location.x = ox;
+ repo.location.y = oy;
+ repo.shopkeeper = shkp;
}
/* called at game exit, after inventory disclosure but before making bones */
void
finish_paybill()
{
- register struct obj *otmp;
- int ox = repo_location.x,
- oy = repo_location.y;
+ struct monst *shkp = repo.shopkeeper;
+ int ox = repo.location.x,
+ oy = repo.location.y;
#if 0 /* don't bother */
if (ox == 0 && oy == 0) impossible("finish_paybill: no location");
#endif
/* normally done by savebones(), but that's too late in this case */
unleash_all();
- /* transfer all of the character's inventory to the shop floor */
- while ((otmp = invent) != 0) {
- otmp->owornmask = 0L; /* perhaps we should call setnotworn? */
- otmp->lamplit = 0; /* avoid "goes out" msg from freeinv */
- if (rn2(5)) curse(otmp); /* normal bones treatment for invent */
- obj_extract_self(otmp);
- place_object(otmp, ox, oy);
+ /* if hero has any gold left, take it into shopkeeper's possession */
+ if (shkp) {
+#ifdef GOLDOBJ
+ long umoney = money_cnt(invent);
+
+ if (umoney) money2mon(shkp, umoney);
+#else
+ shkp->mgold += u.ugold;
+ u.ugold = 0L;
+#endif
}
+ /* transfer rest of the character's inventory to the shop floor */
+ drop_upon_death((struct monst *)0, (struct obj *)0, ox, oy);
}
/* find obj on one of the lists */