fix #K3529 - perm_invent not IDing blank scroll

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.
This commit is contained in:
PatR
2022-02-23 09:50:25 -08:00
parent 645720d1bc
commit 2635c60280
2 changed files with 6 additions and 2 deletions

View 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

View 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();