]> granicus.if.org Git - nethack/commitdiff
fix #K3529 - perm_invent not IDing blank scroll
authorPatR <rankin@nethack.org>
Wed, 23 Feb 2022 17:50:25 +0000 (09:50 -0800)
committerPatR <rankin@nethack.org>
Wed, 23 Feb 2022 17:50:25 +0000 (09:50 -0800)
Report was for curses but issue is in the core so any interface
that supports persistent inventory is affected.  Reading a not-yet-
discovered scroll of blank paper wasn't always updating perm_invent
to show change in formatted description when it became discovered.

Would only happen on turn #1 (so the scroll needed to be acquired
via autopickup at starting location or via wizard mode wish so that
it could be read before any game time elapsed) when the object
discovery routine deliberately avoided updating perm_invent.  Fix
by using a different way than moves==1 to decide whether an object
is being discovered because it is part of hero's initial inventory.

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

index a7f94ed945fcada3f85694de7fe63dde342fce04..c67d7ae3427563076b2c053308e6d2ff3c131c8f 100644 (file)
@@ -814,6 +814,10 @@ give a message when a trapped monster frees itself from some trap
 change kitchen sink glyph to a white {
 killed wood golem has a chance to also drop small shields, clubs,
        elven spears, and boomerangs
+discovering an object on first turn with persistent inventory enabled might
+       not update inventory info for that item (autopickup a blank scroll
+       or spellbook and read it as first action; it becomes discovered but
+       will still be shown as if undiscovered until next inventory update)
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index 8a4a72b30bfb7650369c7857434b06255834a925..6ad5fe0d031cf74e3b4408698b9c0d215c993d98 100644 (file)
@@ -444,8 +444,8 @@ discover_object(int oindx, boolean mark_as_known, boolean credit_hero)
             if (credit_hero)
                 exercise(A_WIS, TRUE);
         }
-        /* moves==1L => initial inventory, gameover => final disclosure */
-        if (g.moves > 1L && !g.program_state.gameover) {
+        /* !in_moveloop => initial inventory, gameover => final disclosure */
+        if (g.program_state.in_moveloop && !g.program_state.gameover) {
             if (objects[oindx].oc_class == GEM_CLASS)
                 gem_learned(oindx); /* could affect price of unpaid gems */
             update_inventory();