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.
This commit is contained in:
nethack.rankin
2006-07-15 03:25:08 +00:00
parent 96c6163019
commit 9631e2b691
4 changed files with 12 additions and 2 deletions

View 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

View 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.

View 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

View 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 */