fix issue #509 - shop 'glob' pricing segfault

A recent change made it possible for a glob to have its dknown flag
cleared and that exposed globby_bill_fixup() passing Null shopkeeper
to get_cost(), triggering a crash.

Make the routine that clears dknown/known/bknown/&c also be the
routine used to initialize those flags for a new object so that it
is the place that handles various special cases.  That hides the
shop bug again.

But also fix the shop bug even though it won't be triggered.

Fixes #509
This commit is contained in:
PatR
2021-05-12 16:13:40 -07:00
parent 25b1baed84
commit b630d5e038
5 changed files with 37 additions and 29 deletions

View File

@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.530 $ $NHDT-Date: 1620590081 2021/05/09 19:54:41 $
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.532 $ $NHDT-Date: 1620861202 2021/05/12 23:13:22 $
General Fixes and Modified Features
-----------------------------------
@@ -665,6 +665,10 @@ if a <foo> corpse was set to revive as a <foo> zombie and corpse was partly
calculate zombie's hit points (depended upon how much had been eaten)
undead turning magic revived corpses flagged as no-revive if they were being
carried but not if they were zapped while on the floor
forgetting an item's known/dknown/bknown/&c settings when picked up by unseen
monster made it possible to trigger a latent shop bug with globs;
avoid clearing dknown flag for globs
fix globby_bill_fixup to use shopkeeper instead of Null for glob pricing
curses: 'msg_window' option wasn't functional for curses unless the binary
also included tty support