From 3165dd942efcfd17006bf5a026dd9ab9fa5d1fb3 Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 11 May 2020 17:51:25 -0700 Subject: [PATCH] fix #K965 - dropped fragile items don't break when the drop is being caused by encumbrance or punishment triggering a fall while going down stairs. Also, remove a couple instances of 'if (obj==GOLD) contexl.botl=TRUE' when dropping gold. They were held over from the obsolete !GOLDOBJ configuration. Both are immediately followed by freeinv() which calls freeinv_core() whichs starts off by setting the botl flag when taking gold out of inventory. --- doc/fixes37.0 | 2 ++ src/ball.c | 5 +++-- src/do.c | 6 ------ src/dothrow.c | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index a77fefe35..853158aac 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -175,6 +175,8 @@ after "double trouble", cloned Wizard would wait until he had suffered some damage or hero moved into direct view; keep STRAT_WAIT for original Wizard but avoid that for clones beyond turn 100000, prayer timeout is longer (scaling with game length) +falling while going down stairs and dropping items due to encumbrance or + punishment wasn't subject fragile ones to breakage Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/ball.c b/src/ball.c index 25bfbd9b6..9005f3900 100644 --- a/src/ball.c +++ b/src/ball.c @@ -980,12 +980,13 @@ litter() for (otmp = g.invent; otmp; otmp = nextobj) { nextobj = otmp->nobj; - if ((otmp != uball) && (rnd(capacity) <= (int) otmp->owt)) { + if (otmp != uball && rnd(capacity) <= (int) otmp->owt) { if (canletgo(otmp, "")) { You("drop %s and %s %s down the stairs with you.", yname(otmp), (otmp->quan == 1L) ? "it" : "they", otense(otmp, "fall")); - dropx(otmp); + freeinv(otmp); + hitfloor(otmp, FALSE); encumber_msg(); /* drop[xyz]() probably ought to to this... */ } } diff --git a/src/do.c b/src/do.c index 8feb069a5..9bbf997f2 100644 --- a/src/do.c +++ b/src/do.c @@ -647,9 +647,6 @@ register struct obj *obj; ELevitation = W_ART; /* other than W_ARTI */ if (flags.verbose) You("drop %s.", doname(obj)); - /* Ensure update when we drop gold objects */ - if (obj->oclass == COIN_CLASS) - g.context.botl = 1; freeinv(obj); hitfloor(obj, TRUE); if (levhack) @@ -670,9 +667,6 @@ void dropx(obj) register struct obj *obj; { - /* Ensure update when we drop gold objects */ - if (obj->oclass == COIN_CLASS) - g.context.botl = 1; freeinv(obj); if (!u.uswallow) { if (ship_object(obj, u.ux, u.uy, FALSE)) diff --git a/src/dothrow.c b/src/dothrow.c index 54326bb36..1e6930c8e 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -440,7 +440,7 @@ boolean verbose; } /* Object hits floor at hero's feet. - Called from drop(), throwit(), hold_another_object(). */ + Called from drop(), throwit(), hold_another_object(), litter(). */ void hitfloor(obj, verbosely) struct obj *obj;