This took me a while to track down.  I noticed it while drinking
unpaid potions but didn't expect the issue to be potion-specific.
Affects paying shop bill in addition to examining [former] inventory.

Start with a stack of 3 unpaid potions.
Iu
a - 3 potions of healing (unpaid)
Ix
no used up items

Drink one.
qa
Iu
a - 2 potions of healing (unpaid)
Ix
x - potion of healing

So, far everything's normal.  Note that 'x' is an arbitrary letter
used for expended items when shown in inventory style rather than an
inventory letter or menu choice.

Drink another.
qa
Iu
a - a potion of healing (unpaid)
Ix
x - potion of healing
x - potion of healing

Drink the last one.
qa
Iu
no unpaid items
Ix
x - potion of healing
x - potion of healing
x - potion of healing

In 3.4.3, these last two Ix cases would have had single lines of
'x - 2 potions of healing' and 'x - 3 potions of healing', respectively.

After this fix, they will again--unless potion stack 'a' was wielded,
readied as alt-weapon, or quivered.
This commit is contained in:
PatR
2024-06-21 15:32:46 -07:00
parent bf1e3d3e56
commit 54138bbbe3
2 changed files with 27 additions and 13 deletions
+4
View File
@@ -1422,6 +1422,10 @@ if hero is on scroll of scare monster or Elbereth, werecreature switching from
"n <count> ESC c" wasn't treated as "n <count> M-c" because reading "n <count> ESC c" wasn't treated as "n <count> M-c" because reading
the 'n' changed program_state.input_state from commandInp to otherInp, the 'n' changed program_state.input_state from commandInp to otherInp,
preventing special ESC handling; not an issue when number_pad was Off preventing special ESC handling; not an issue when number_pad was Off
a 3.6 fix to avoid a potential "object lost" panic when drinking potions had
unintended side-effect of making used up potions on shop's bill become
separate bill entries all with count 1 despite having come from same
unpaid stack; affected Ix inventory listing and itemized shop billing
Fixes to 3.7.0-x General Problems Exposed Via git Repository Fixes to 3.7.0-x General Problems Exposed Via git Repository
+23 -13
View File
@@ -570,19 +570,29 @@ dodrink(void)
if (!otmp) if (!otmp)
return ECMD_CANCEL; return ECMD_CANCEL;
/* quan > 1 used to be left to useup(), but we need to force /*
the current potion to be unworn, and don't want to do * 3.6: quan > 1 used to be left to useup(), but we need to
that for the entire stack when starting with more than 1. * force the current potion to be unworn, and don't want to do
[Drinking a wielded potion of polymorph can trigger a shape * that for the entire stack when starting with more than 1.
change which causes hero's weapon to be dropped. In 3.4.x, * [Drinking a wielded potion of polymorph can trigger a shape
that led to an "object lost" panic since subsequent useup() * change which causes hero's weapon to be dropped. In 3.4.x,
was no longer dealing with an inventory item. Unwearing * that led to an "object lost" panic since subsequent useup()
the current potion is intended to keep it in inventory.] */ * was no longer dealing with an inventory item. Unwearing
if (otmp->quan > 1L) { * the current potion is intended to keep it in inventory.]
otmp = splitobj(otmp, 1L); *
otmp->owornmask = 0L; /* rest of original stuck unaffected */ * 3.7: switch back to relying on useup() unless the object is
} else if (otmp->owornmask) { * actually worn. Otherwise drinking a stack of unpaid potions
remove_worn_item(otmp, FALSE); * one by one in a shop makes each one a separate used-up item
* for 'Ix' invent display and for itemized shop billing instead
* of having a single stack with quantity greater than 1.
*/
if (otmp->owornmask) {
if (otmp->quan > 1L) {
otmp = splitobj(otmp, 1L);
otmp->owornmask = 0L; /* rest of original stack is unaffected */
} else {
remove_worn_item(otmp, FALSE);
}
} }
otmp->in_use = TRUE; /* you've opened the stopper */ otmp->in_use = TRUE; /* you've opened the stopper */