From: nethack.rankin Date: Sat, 15 Jul 2006 03:25:08 +0000 (+0000) Subject: fix #H148 - applying a pickaxe doesn't respect pushweapon X-Git-Tag: MOVE2GIT~943 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9631e2b691afe22c237020a02068de0c55d2b1ae;p=nethack fix #H148 - applying a pickaxe doesn't respect pushweapon 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. --- diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 26524395a..f1045bc24 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -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 diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index 5a8225e94..754afde17 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -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. diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 8675fd471..bfa5d36c2 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -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 diff --git a/src/wield.c b/src/wield.c index c6507c2e3..f37dd0607 100644 --- a/src/wield.c +++ b/src/wield.c @@ -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 */