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:
15
src/invent.c
15
src/invent.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 invent.c $NHDT-Date: 1620329776 2021/05/06 19:36:16 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.330 $ */
|
||||
/* NetHack 3.7 invent.c $NHDT-Date: 1620861205 2021/05/12 23:13:25 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.331 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Derek S. Ray, 2015. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -2150,19 +2150,6 @@ askchain(struct obj **objchn, /* *objchn might change */
|
||||
return cnt;
|
||||
}
|
||||
|
||||
/* hero is losing access to previously known info about an object
|
||||
(called when an unseen monster picks up or uses the object) */
|
||||
void
|
||||
unknow_object(struct obj *obj)
|
||||
{
|
||||
obj->dknown = 0;
|
||||
obj->bknown = obj->rknown = 0;
|
||||
obj->cknown = obj->lknown = 0;
|
||||
/* awareness of charges or enchantment has gone poof... */
|
||||
if (objects[obj->otyp].oc_uses_known)
|
||||
obj->known = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Object identification routines:
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user