]> granicus.if.org Git - nethack/commitdiff
itemized billing vs persistent inventory, round II
authorPatR <rankin@nethack.org>
Tue, 14 Jun 2022 22:48:45 +0000 (15:48 -0700)
committerPatR <rankin@nethack.org>
Tue, 14 Jun 2022 22:48:45 +0000 (15:48 -0700)
Reported by entrez:  buying an unpaid item using itemized billing used
to result in the price information for unpaid items disappearing when
they get shown by perm_invent.  (Their status as unpaid didn't change;
persistent inventory just got redrawn without cost information.)  The
fix for that didn't handle buying a used-up item.  There's no invent
update for the gone-item item but there is one for moving gold out of
hero's inventory to add to shopkeeper's inventory.  The vanishing
price phenomenon applied to that situation too.

I can't think of any situation where persistent inventory would want
to hide unpaid status and/or cost, so always prevent those from being
excluded during perm_invent update.

doc/fixes3-7-0.txt
src/invent.c

index 4af91791fed730663c92f456d5b973c3c604a47c..3d63000084004751fd0cebfa1e0bd73fc72416d9 100644 (file)
@@ -1250,6 +1250,10 @@ after the fix for zombie reviving near hero (which now interrupts hero's
        it revived on the same turn that eating the corpse would finish
 a wizard's starting equipment was supposed to include a random spellbook of
        spell level 1 through 3 but it was being foced to be level 1
+earlier fix for prices of unpaid objects going away in persistent inventory
+       display when hero bought something during itemized billing didn't work
+       if paying for a used-up shop item--prices of any unpaid items vanished
+       when inventory got updated to reflect transfer of hero's gold to shk
 
 curses: 'msg_window' option wasn't functional for curses unless the binary
        also included tty support
index 0c62d736664e4245a165c7d9307d23cf05be858a..04b4dc5d5d46a81ecabc4b63d6b783127e996968 100644 (file)
@@ -2405,6 +2405,8 @@ learn_unseen_invent(void)
 void
 update_inventory(void)
 {
+    boolean save_suppress_price;
+
     if (suppress_map_output()) /* despite name, used for perm_invent too */
         return;
 
@@ -2414,8 +2416,21 @@ update_inventory(void)
      * We currently don't skip this call when iflags.perm_invent is False
      * because curses uses that to disable a previous perm_invent window
      * (after toggle via 'O'; perhaps the options code should handle that).
+     *
+     * perm_invent might get updated while some code is avoiding price
+     * feedback during obj name formatting for messages.  Temporarily
+     * force 'normal' formatting during the perm_invent update.  (Cited
+     * example was an update triggered by change in invent gold when
+     * transferring some to shk during itemized billing.  A previous fix
+     * attempt in the shop code handled it for unpaid items but not for
+     * paying for used-up shop items; that follows a different code path.)
      */
+    save_suppress_price = iflags.suppress_price;
+    iflags.suppress_price = FALSE;
+
     (*windowprocs.win_update_inventory)(0);
+
+    iflags.suppress_price = save_suppress_price;
 }
 
 /* the #perminv command - call interface's persistent inventory routine */