]> granicus.if.org Git - nethack/commitdiff
fix #H148 - applying a pickaxe doesn't respect pushweapon
authornethack.rankin <nethack.rankin>
Sat, 15 Jul 2006 03:25:08 +0000 (03:25 +0000)
committernethack.rankin <nethack.rankin>
Sat, 15 Jul 2006 03:25:08 +0000 (03:25 +0000)
     From a bug report, applying a pick-axe will
wield it in place of the primary weapon but wouldn't update the alternate
weapon.  Make objects which become wielded when applied (pick, lamp, whip,
grappling hook, pole-arm) honor the pushweapon option (where the previously
wielded weapon becomes the alternate weapon without use of 'x' command) the
same as when explicitly wielded.  Old behavior matched the documentation,
but that seemed overly restrictive.

doc/Guidebook.mn
doc/Guidebook.tex
doc/fixes34.4
src/wield.c

index 26524395a7dabf4ffb894701c724c80c2b657d1a..f1045bc24c1911618449eb2bab0bc5e65b52b69a 100644 (file)
@@ -2113,6 +2113,8 @@ Prompt for confirmation before praying (default on).
 .lp pushweapon
 Using the `w' (wield) command when already wielding
 something pushes the old item into your alternate weapon slot (default off).
+Likewise for the `a' (apply) command if it causes the applied item to
+become wielded.
 .lp "race    "
 Selects your race (for example, ``race:human'').  Default is random.
 If you prefix a `!' or ``no'' to the value, you can 
index 5a8225e942833ddd24e6e1a8a9c93987493ee0db..754afde17a7f3bb655455c2dbaa6ecc52bd62599 100644 (file)
@@ -27,7 +27,7 @@
 \begin{document}
 %
 % input file: guidebook.mn
-% $Revision: 1.99 $ $Date: 2006/05/13 04:57:35 $
+% $Revision: 1.100 $ $Date: 2006/05/18 04:18:23 $
 %
 %.ds h0 "
 %.ds h1 %.ds h2 \%
@@ -2578,6 +2578,8 @@ Prompt for confirmation before praying (default on).
 \item[\ib{pushweapon}]
 Using the `w' (wield) command when already wielding
 something pushes the old item into your alternate weapon slot (default off).
+Likewise for the `a' (apply) command if it causes the applied item to
+become wielded.
 %.Ip
 \item[\ib{race}]
 Selects your race (for example, ``{\tt race:human}'').  Default is random.
index 8675fd471b9dd82d86db3830e7bc9a25a0fbd8e7..bfa5d36c203123499dd6fbd5ce624c0429edb61c 100644 (file)
@@ -241,6 +241,7 @@ remove makedefs.c dependency that time_t and long are the same size
 terminal window set to 21 lines can cause a crash during player selection 
        menus; have bot() check for valid youmonst.data
 free storage used to hold region messages in free_region()
+honor pushweapon when applying a tool or weapon causes it to become wielded
 
 
 Platform- and/or Interface-Specific Fixes
index c6507c2e358550738f26f3c35d0f1977f94e0db6..f37dd0607eee9cd820ae49734ba53cf68c827a48 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)wield.c    3.5     2006/06/16      */
+/*     SCCS Id: @(#)wield.c    3.5     2006/07/14      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -465,14 +465,19 @@ const char *verb; /* "rub",&c */
            verb, (obj->oclass == WEAPON_CLASS) ? "weapon" : "tool");
        return FALSE;
     }
+
     if (uquiver == obj) setuqwep((struct obj *)0);
     if (uswapwep == obj) {
        (void) doswapweapon();
        /* doswapweapon might fail */
        if (uswapwep == obj) return FALSE;
     } else {
+       struct obj *oldwep = uwep;
+
        You("now wield %s.", doname(obj));
        setuwep(obj);
+       if (flags.pushweapon && oldwep && uwep != oldwep)
+           setuswapwep(oldwep);
     }
     if (uwep != obj) return FALSE;     /* rewielded old object after dying */
     /* applying weapon or tool that gets wielded ends two-weapon combat */