encumbrance feedback fix

Wishing for an item uses hold_another_object to put it into inventory
and hold_another_object wasn't reporting changes in encumbrance.  That
feedback would happen at start of next turn so its lack usually wasn't
noticeable, but encumbrance could be off for remainder of the current
turn which might include additional move(s).  Report indicated that
dropping something seemed to increase encumbrance instead of decrease
it, but it was dropped on an extra move and actually a delayed report
of the increase that hold_another_object failed to show.

I fixed a couple of other things with hold_another_object:  it would
add an item to inventory, which triggered an update of persistent
inventory if that was enabled, then remove it from inventory in order
to drop it if fumbling or inventory had too many items or encumbrance
was going to become too high, triggering a second update of persistent
inventory to reverse the first one.  Also, "encumbrance becoming too
high" was using hardcoded Stressed instead of the 'pickup_burden'
option that manages the same situation during pickup.  Not because
hold_another_object isn't pickup, but because its use of hardcoded
Stressed predated implementation of that option.

There was another fix for hold_another_object recently and I've moved
the fixes entry for that one to group it with the new ones.

Also, update an obsolete (from !GOLDOBJ config) comment in makewish().
This commit is contained in:
PatR
2020-05-14 14:27:49 -07:00
parent 41ae223585
commit c7dba5fbc4
3 changed files with 37 additions and 20 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 zap.c $NHDT-Date: 1586633039 2020/04/11 19:23:59 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.335 $ */
/* NetHack 3.6 zap.c $NHDT-Date: 1589491666 2020/05/14 21:27:46 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.340 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -5365,9 +5365,8 @@ makewish()
}
/*
* Note: if they wished for and got a non-object successfully,
* otmp == &cg.zeroobj. That includes gold, or an artifact that
* has been denied. Wishing for "nothing" requires a separate
* value to remain distinct.
* otmp == &zeroobj. That includes an artifact which has been denied.
* Wishing for "nothing" requires a separate value to remain distinct.
*/
otmp = readobjnam(buf, &nothing);
if (!otmp) {