From cfc4612338385fd06257d5111411b7cc0e3a7a6c Mon Sep 17 00:00:00 2001 From: nhmall Date: Wed, 2 Dec 2020 21:59:26 -0500 Subject: [PATCH] correct coding typo: nx instead of ny Prevented proper migration of obj dropped down the stairs. Also, don't include your attached chain when counting drop impacts. --- src/dokick.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/dokick.c b/src/dokick.c index 114a217b8..84d373421 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -18,7 +18,7 @@ static void FDECL(kick_monster, (struct monst *, XCHAR_P, XCHAR_P)); static int FDECL(kick_object, (XCHAR_P, XCHAR_P, char *)); static int FDECL(really_kick_object, (XCHAR_P, XCHAR_P)); static char *FDECL(kickstr, (char *, const char *)); -static void FDECL(otransit_msg, (struct obj *, BOOLEAN_P, long)); +static void FDECL(otransit_msg, (struct obj *, BOOLEAN_P, BOOLEAN_P, long)); static void FDECL(drop_to, (coord *, SCHAR_P, XCHAR_P, XCHAR_P)); static const char kick_passes_thru[] = "kick passes harmlessly through"; @@ -1510,7 +1510,7 @@ boolean shop_floor_obj; coord cc; struct obj *obj; struct trap *t; - boolean nodrop, unpaid, container, impact = FALSE; + boolean nodrop, unpaid, container, impact = FALSE, chainthere = FALSE; long n = 0L; if (!otmp) @@ -1530,9 +1530,12 @@ boolean shop_floor_obj; unpaid = is_unpaid(otmp); if (OBJ_AT(x, y)) { - for (obj = g.level.objects[x][y]; obj; obj = obj->nexthere) - if (obj != otmp) + for (obj = g.level.objects[x][y]; obj; obj = obj->nexthere) { + if (obj == uchain) + chainthere = TRUE; + else if (obj != otmp) n += obj->quan; + } if (n) impact = TRUE; } @@ -1546,7 +1549,7 @@ boolean shop_floor_obj; } if (cansee(x, y)) - otransit_msg(otmp, nodrop, n); + otransit_msg(otmp, nodrop, chainthere, n); if (nodrop) { if (impact) @@ -1665,7 +1668,7 @@ boolean near_hero; case MIGR_SSTAIRS: if ((stway = stairway_find_from(&fromdlev, isladder)) != 0) { nx = stway->sx; - nx = stway->sy; + ny = stway->sy; } break; case MIGR_WITH_HERO: @@ -1766,9 +1769,9 @@ unsigned long deliverflags; } static void -otransit_msg(otmp, nodrop, num) +otransit_msg(otmp, nodrop, chainthere, num) register struct obj *otmp; -register boolean nodrop; +boolean nodrop, chainthere; long num; { char *optr = 0, obuf[BUFSZ], xbuf[BUFSZ]; @@ -1782,11 +1785,15 @@ long num; } Strcpy(obuf, optr); - if (num) { /* means: other objects are impacted */ + if (num || chainthere) { /* As of 3.6.2: use a separate buffer for the suffix to avoid risk of overrunning obuf[] (let pline() handle truncation if necessary) */ - Sprintf(xbuf, " %s %s object%s", otense(otmp, "hit"), - (num == 1L) ? "another" : "other", (num > 1L) ? "s" : ""); + if (num) { /* means: other objects are impacted */ + Sprintf(xbuf, " %s %s object%s", otense(otmp, "hit"), + (num == 1L) ? "another" : "other", (num > 1L) ? "s" : ""); + } else { /* chain-only msg */ + Sprintf(xbuf, " %s your chain", otense(otmp, "rattle")); + } if (nodrop) Sprintf(eos(xbuf), "."); else