From 5a9550819c430b70e955e9682067f55d9b8a205c Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Tue, 8 Oct 2002 11:28:21 +0000 Subject: [PATCH] B13005 grammar: "A scrolls burns." This was caused by taking a copy of the name prior to a later delobj for use in the message. The name would always be plural if there was more than one, so that pluralized name would be used even if only one of the stack was destroyed. Sometimes the name saved was "scrolls labeled XXXX." This patch simply saves a pluralized name and a single version and uses the appropriate one in the message, rather than introducing splitobj() complications. --- src/zap.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/zap.c b/src/zap.c index 8995e9abf..0d7f977ad 100644 --- a/src/zap.c +++ b/src/zap.c @@ -3154,7 +3154,7 @@ boolean u_caused; { struct obj *obj, *obj2; long i, scrquan, delquan; - const char *what; + char buf1[BUFSZ], buf2[BUFSZ]; int cnt = 0; for (obj = level.objects[x][y]; obj; obj = obj2) { @@ -3169,8 +3169,15 @@ boolean u_caused; if (!rn2(3)) delquan++; if (delquan) { /* save name before potential delobj() */ - what = !give_feedback ? 0 : (x == u.ux && y == u.uy) ? - xname(obj) : distant_name(obj, xname); + if (give_feedback) { + obj->quan = 1; + Strcpy(buf1, (x == u.ux && y == u.uy) ? + xname(obj) : distant_name(obj, xname)); + obj->quan = 2; + Strcpy(buf2, (x == u.ux && y == u.uy) ? + xname(obj) : distant_name(obj, xname)); + obj->quan = scrquan; + } /* useupf(), which charges, only if hero caused damage */ if (u_caused) useupf(obj, delquan); else if (delquan < scrquan) obj->quan -= delquan; @@ -3178,9 +3185,9 @@ boolean u_caused; cnt += delquan; if (give_feedback) { if (delquan > 1) - pline("%ld %s burn.", delquan, what); + pline("%ld %s burn.", delquan, buf2); else - pline("%s burns.", An(what)); + pline("%s burns.", An(buf1)); } } } -- 2.50.1