]> granicus.if.org Git - nethack/commitdiff
fix B17006 - stacked boomerang handling
authornethack.rankin <nethack.rankin>
Sat, 25 Jan 2003 07:33:06 +0000 (07:33 +0000)
committernethack.rankin <nethack.rankin>
Sat, 25 Jan 2003 07:33:06 +0000 (07:33 +0000)
     Breaking a boomerang while bashing with it didn't work right when
there was a stack of more than one involved.  The message given had a
grammar buglet and the remaining boomerangs became unwielded.  (This
issue wasn't present in 3.4.0 because the boomerang bashing code never
got called there.)

src/uhitm.c

index 3ed1961f21a60edcae78d393b5b5f455f1756fd6..3cad55a45dd1a177a71ed557684191afebbfb640 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)uhitm.c    3.4     2003/01/02      */
+/*     SCCS Id: @(#)uhitm.c    3.4     2003/01/24      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -580,11 +580,14 @@ int thrown;
                        tmp = rnd(2);
                    if (!thrown && obj == uwep && obj->otyp == BOOMERANG &&
                            rnl(4) == 4-1) {
-                       pline("As you hit %s, %s %s breaks into splinters.",
-                           mon_nam(mon), shk_your(yourbuf, obj), xname(obj));
-                       uwepgone();             /* set unweapon */
+                       boolean more_than_1 = (obj->quan > 1L);
+
+                       pline("As you hit %s, %s%s %s breaks into splinters.",
+                             mon_nam(mon), more_than_1 ? "one of " : "",
+                             shk_your(yourbuf, obj), xname(obj));
+                       if (!more_than_1) uwepgone();   /* set unweapon */
                        useup(obj);
-                       obj = (struct obj *) 0;
+                       if (!more_than_1) obj = (struct obj *) 0;
                        hittxt = TRUE;
                        if (mdat != &mons[PM_SHADE])
                            tmp++;