]> granicus.if.org Git - nethack/commitdiff
B13005 grammar: "A scrolls burns."
authornethack.allison <nethack.allison>
Tue, 8 Oct 2002 11:28:21 +0000 (11:28 +0000)
committernethack.allison <nethack.allison>
Tue, 8 Oct 2002 11:28:21 +0000 (11:28 +0000)
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

index 8995e9abfd1edf5d7b5ddc12b4420d212aba89b2..0d7f977adbc3d8d13e683cfbb7d7d5f63ceab867 100644 (file)
--- 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));
                    }
                }
            }