]> granicus.if.org Git - nethack/commit
fix some of #H7156 - perm_invent issues
authorPatR <rankin@nethack.org>
Sat, 19 May 2018 11:19:18 +0000 (04:19 -0700)
committerPatR <rankin@nethack.org>
Sat, 19 May 2018 11:19:18 +0000 (04:19 -0700)
commite9f1e032717921cb7a51c0f2822628355a35ec36
tree7980911ce693e8d4b393eb9bda07c4443d112970
parentbed79b83913c91911c8d7b0d015ebd06edf96dcf
fix some of #H7156 - perm_invent issues

> [1. perm_invent is kept in flags so persists across save/restore, but
>  perm_invent capability can change if player restores with a different
>  interface--or same one running on a different-sized display--so it
>  ought to be in iflags instead.]

Not addressed here.

> 2. perm_invent window does not get updated when charging a wand (or
> other chargeable item presumably), with a scroll of charging.

Most scrolls rely on useup() -> update_inventory(), but charging uses up
the scroll early so that it will be gone from inventory when choosing an
item to charge.  It needed an explicit update_inventory() after charging.

> 3. update_inventory(), is called from setworn(), which is called from
> dorestore(), when loading a save.  Segfaults have been observed in
> variants based on this code (though not yet in vanilla 3.6.1), so it's
> possible this may be unsafe.  The update_inventory() call in setworn()
> could be protected with "if (!restoring) ..."

tty doesn't support perm_invent, so this might be a win32 issue.
I've made the suggested change, but a better fix would be to turn off
perm_invent as soon as options processing (new game) or options restore
(old game unless/until #1 gets changed) has finished setting things up,
then turn it back on at the end of moveloop()'s prolog when play is
about to start.

 = =

Most of the read.c change is reordering prototypes to match the order
of the corresponding functions.  I did this when adding a new static
routine, then ended up discarding that routine.
doc/fixes36.2
src/read.c
src/worn.c