Merge branch 'NetHack-3.6'

This commit is contained in:
nhmall
2019-10-04 22:31:35 -04:00
6 changed files with 93 additions and 52 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 polyself.c $NHDT-Date: 1559664952 2019/06/04 16:15:52 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.133 $ */
/* NetHack 3.6 polyself.c $NHDT-Date: 1570230710 2019/10/04 23:11:50 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.134 $ */
/* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */
@@ -23,6 +23,7 @@
static void FDECL(check_strangling, (BOOLEAN_P));
static void FDECL(polyman, (const char *, const char *));
static void FDECL(dropp, (struct obj *));
static void NDECL(break_armor);
static void FDECL(drop_weapon, (int));
static int FDECL(armor_to_dragon, (int));
@@ -876,6 +877,33 @@ int mntmp;
return 1;
}
/* dropx() jacket for break_armor() */
static void
dropp(obj)
struct obj *obj;
{
struct obj *otmp;
/*
* Dropping worn armor while polymorphing might put hero into water
* (loss of levitation boots or water walking boots that the new
* form can't wear), where emergency_disrobe() could remove it from
* inventory. Without this, dropx() could trigger an 'object lost'
* panic. Right now, boots are the only armor which might encounter
* this situation, but handle it for all armor.
*
* Hypothetically, 'obj' could have merged with something (not
* applicable for armor) and no longer be a valid pointer, so scan
* inventory for it instead of trusting obj->where.
*/
for (otmp = g.invent; otmp; otmp = otmp->nobj) {
if (otmp == obj) {
dropx(obj);
break;
}
}
}
static void
break_armor()
{
@@ -894,7 +922,7 @@ break_armor()
if (otmp->oartifact) {
Your("%s falls off!", cloak_simple_name(otmp));
(void) Cloak_off();
dropx(otmp);
dropp(otmp);
} else {
Your("%s tears apart!", cloak_simple_name(otmp));
(void) Cloak_off();
@@ -911,7 +939,7 @@ break_armor()
cancel_don();
Your("armor falls around you!");
(void) Armor_gone();
dropx(otmp);
dropp(otmp);
}
if ((otmp = uarmc) != 0) {
if (is_whirly(g.youmonst.data))
@@ -919,7 +947,7 @@ break_armor()
else
You("shrink out of your %s!", cloak_simple_name(otmp));
(void) Cloak_off();
dropx(otmp);
dropp(otmp);
}
if ((otmp = uarmu) != 0) {
if (is_whirly(g.youmonst.data))
@@ -927,7 +955,7 @@ break_armor()
else
You("become much too small for your shirt!");
setworn((struct obj *) 0, otmp->owornmask & W_ARMU);
dropx(otmp);
dropp(otmp);
}
}
if (has_horns(g.youmonst.data)) {
@@ -945,7 +973,7 @@ break_armor()
Your("%s falls to the %s!", helm_simple_name(otmp),
surface(u.ux, u.uy));
(void) Helmet_off();
dropx(otmp);
dropp(otmp);
}
}
}
@@ -957,12 +985,12 @@ break_armor()
You("drop your gloves%s!", uwep ? " and weapon" : "");
drop_weapon(0);
(void) Gloves_off();
dropx(otmp);
dropp(otmp);
}
if ((otmp = uarms) != 0) {
You("can no longer hold your shield!");
(void) Shield_off();
dropx(otmp);
dropp(otmp);
}
if ((otmp = uarmh) != 0) {
if (donning(otmp))
@@ -970,7 +998,7 @@ break_armor()
Your("%s falls to the %s!", helm_simple_name(otmp),
surface(u.ux, u.uy));
(void) Helmet_off();
dropx(otmp);
dropp(otmp);
}
}
if (nohands(g.youmonst.data) || verysmall(g.youmonst.data)
@@ -984,7 +1012,7 @@ break_armor()
Your("boots %s off your feet!",
verysmall(g.youmonst.data) ? "slide" : "are pushed");
(void) Boots_off();
dropx(otmp);
dropp(otmp);
}
}
}
@@ -1037,6 +1065,10 @@ int alone;
updateinv = FALSE;
else if (candropwep)
dropx(otmp);
/* [note: dropp vs dropx -- if heart of ahriman is wielded, we
might be losing levitation by dropping it; but that won't
happen until the drop, unlike Boots_off() dumping hero into
water and triggering emergency_disrobe() before dropx()] */
if (updateinv)
update_inventory();