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.
This commit is contained in:
+6
-3
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 worn.c $NHDT-Date: 1496959481 2017/06/08 22:04:41 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.49 $ */
|
||||
/* NetHack 3.6 worn.c $NHDT-Date: 1526728754 2018/05/19 11:19:14 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.51 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2013. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -105,7 +105,8 @@ long mask;
|
||||
}
|
||||
}
|
||||
}
|
||||
update_inventory();
|
||||
if (!restoring)
|
||||
update_inventory();
|
||||
}
|
||||
|
||||
/* called e.g. when obj is destroyed */
|
||||
@@ -136,7 +137,9 @@ register struct obj *obj;
|
||||
if ((p = w_blocks(obj, wp->w_mask)) != 0)
|
||||
u.uprops[p].blocked &= ~wp->w_mask;
|
||||
}
|
||||
update_inventory();
|
||||
/* setnotworn() isn't called during restore but parallel setworn() */
|
||||
if (!restoring)
|
||||
update_inventory();
|
||||
}
|
||||
|
||||
/* return a bitmask of the equipment slot(s) a given item might be worn in */
|
||||
|
||||
Reference in New Issue
Block a user