From: PatR Date: Sun, 14 Oct 2018 09:47:09 +0000 (-0700) Subject: fix github pull request #144 - uswapwep vs shield X-Git-Tag: NetHack-3.6.2_Released~186^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=239c3cef558afdd6814887c452b3955c8c45260a;p=nethack fix github pull request #144 - uswapwep vs shield Fixes #144 While giving a new character his/her starting equipment, don't clear alternate weapon when putting on a shield since that weapon should still be available to swap with primary. Affected knight's lance and valkyrie's dagger. Also, guard against wearing an initial shield if already wielding a two-handed weapon, or wielding such a weapon if already wearing a shield. Both situations are hypothetical with current starting gear. --- diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 7ab677032..f63ea6f13 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -161,6 +161,8 @@ change default value for the 'autodescribe' option to 'on' Elbereth hypocrisy penalty doesn't apply if attacking a monster which isn't frightened by Elbereth; normal scuffing of engravings still applies Elbereth hypocrisy penalty reduced when alignment is already low +during character creation, don't unset alternate weapon when a shield gets + worn (was preventing knight from having lance set up as uswapwep) Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/u_init.c b/src/u_init.c index 44fb9142a..5b5c5113f 100644 --- a/src/u_init.c +++ b/src/u_init.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 u_init.c $NHDT-Date: 1526755625 2018/05/19 18:47:05 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.42 $ */ +/* NetHack 3.6 u_init.c $NHDT-Date: 1539510426 2018/10/14 09:47:06 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.43 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2017. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1112,10 +1112,13 @@ register struct trobj *trop; discover_object(POT_OIL, TRUE, FALSE); if (obj->oclass == ARMOR_CLASS) { - if (is_shield(obj) && !uarms) { + if (is_shield(obj) && !uarms && !(uwep && bimanual(uwep))) { setworn(obj, W_ARMS); - if (uswapwep) - setuswapwep((struct obj *) 0); + /* 3.6.2: this used to unset uswapwep if it was set, but + wearing a shield doesn't prevent having an alternate + weapon ready to swap with the primary; just make sure we + aren't two-weaponing (academic; no one starts that way) */ + u.twoweap = FALSE; } else if (is_helmet(obj) && !uarmh) setworn(obj, W_ARMH); else if (is_gloves(obj) && !uarmg) @@ -1135,10 +1138,11 @@ register struct trobj *trop; if (is_ammo(obj) || is_missile(obj)) { if (!uquiver) setuqwep(obj); - } else if (!uwep) + } else if (!uwep && (!uarms || !bimanual(obj))) { setuwep(obj); - else if (!uswapwep) + } else if (!uswapwep) { setuswapwep(obj); + } } if (obj->oclass == SPBOOK_CLASS && obj->otyp != SPE_BLANK_PAPER) initialspell(obj);