From: PatR Date: Tue, 14 Jun 2022 22:48:45 +0000 (-0700) Subject: itemized billing vs persistent inventory, round II X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c75e6b01a5bdf604992ed63fbbb4e3591c3bffb;p=nethack itemized billing vs persistent inventory, round II 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. --- diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 4af91791f..3d6300008 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -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 diff --git a/src/invent.c b/src/invent.c index 0c62d7366..04b4dc5d5 100644 --- a/src/invent.c +++ b/src/invent.c @@ -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 */