'w-' object lost panic
After the "make 'w' parallel with 'Q'" patch, wielding bare hands was erroneously treating object id 0 as a split of zeroobj. That isn't in inventory so seems 'lost'. Fixed by testing for nonzero. There was another bug: you could wield a partial stack even if your current weapon was cursed. Fixed by reordering if/else-if/end-if.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.33 $ $NHDT-Date: 1577184069 2019/12/24 10:41:09 $
|
||||
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.34 $ $NHDT-Date: 1577186790 2019/12/24 11:26:30 $
|
||||
|
||||
General Fixes and Modified Features
|
||||
-----------------------------------
|
||||
@@ -28,6 +28,8 @@ fix compile when DLB isn't defined
|
||||
urealtime.realtime was being incorrectly calculated
|
||||
revised "mysterious force" when climbing out of gehennom could generate
|
||||
warnings about "rn2(0) attempted" or "rn2(-n) attempted"
|
||||
after 'w' on split stack patch, wielding '-' would cause an object_lost panic
|
||||
same patch allowed partial stack from getobj to replace cursed wielded weapon
|
||||
|
||||
|
||||
Platform- and/or Interface-Specific Fixes
|
||||
|
||||
25
src/wield.c
25
src/wield.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 wield.c $NHDT-Date: 1577055058 2019/12/22 22:50:58 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.68 $ */
|
||||
/* NetHack 3.6 wield.c $NHDT-Date: 1577186790 2019/12/24 11:26:30 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.69 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2009. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -275,16 +275,6 @@ dowield()
|
||||
if (!(wep = getobj(wield_objs, "wield"))) {
|
||||
/* Cancelled */
|
||||
return 0;
|
||||
} else if (wep->o_id == g.context.objsplit.child_oid) {
|
||||
/* if wep is the result of supplying a count to getobj()
|
||||
we don't want to split something already wielded; for
|
||||
any other item, we need to give it its own inventory slot */
|
||||
if (uwep && uwep->o_id == g.context.objsplit.parent_oid) {
|
||||
unsplitobj(wep);
|
||||
goto already_wielded;
|
||||
}
|
||||
finish_splitting = TRUE;
|
||||
goto wielding;
|
||||
} else if (wep == uwep) {
|
||||
already_wielded:
|
||||
You("are already wielding that!");
|
||||
@@ -295,7 +285,20 @@ dowield()
|
||||
weldmsg(uwep);
|
||||
/* previously interrupted armor removal mustn't be resumed */
|
||||
reset_remarm();
|
||||
/* if player chose a partial stack but can't wield it, undo split */
|
||||
if (wep->o_id && wep->o_id == g.context.objsplit.child_oid)
|
||||
unsplitobj(wep);
|
||||
return 0;
|
||||
} else if (wep->o_id && wep->o_id == g.context.objsplit.child_oid) {
|
||||
/* if wep is the result of supplying a count to getobj()
|
||||
we don't want to split something already wielded; for
|
||||
any other item, we need to give it its own inventory slot */
|
||||
if (uwep && uwep->o_id == g.context.objsplit.parent_oid) {
|
||||
unsplitobj(wep);
|
||||
goto already_wielded;
|
||||
}
|
||||
finish_splitting = TRUE;
|
||||
goto wielding;
|
||||
}
|
||||
|
||||
/* Handle no object, or object in other slot */
|
||||
|
||||
Reference in New Issue
Block a user