fix #H9312 - partly eaten food in bones shop
Dying in a shop while carrying partly eaten food would place that food on the floor without marking it no_charge. But marking it that way wouldn't have helped because as bones data gets saved, every object on the level has its no_charge flag cleared. So 'no_charge' needs to be explicitly set for partly eaten food in tended shops as a bones level gets loaded. Most of the shk.c diff is reformatting, but it does change the get_pricing_units() routine to lie that the quantity is zero for partly eaten food so that when multiplying with price it won't matter whether the price has been forced to zero or been left non-zero.
This commit is contained in:
20
src/bones.c
20
src/bones.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 bones.c $NHDT-Date: 1557092711 2019/05/05 21:45:11 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.75 $ */
|
||||
/* NetHack 3.6 bones.c $NHDT-Date: 1571363147 2019/10/18 01:45:47 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.76 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985,1993. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -85,6 +85,24 @@ boolean restore;
|
||||
} else if (has_oname(otmp)) {
|
||||
sanitize_name(ONAME(otmp));
|
||||
}
|
||||
/* 3.6.3: set no_charge for partly eaten food in shop;
|
||||
all other items become goods for sale if in a shop */
|
||||
if (otmp->oclass == FOOD_CLASS && otmp->oeaten) {
|
||||
struct obj *top;
|
||||
char *p;
|
||||
xchar ox, oy;
|
||||
|
||||
for (top = otmp; top->where == OBJ_CONTAINED;
|
||||
top = top->ocontainer)
|
||||
continue;
|
||||
otmp->no_charge = (top->where == OBJ_FLOOR
|
||||
&& get_obj_location(top, &ox, &oy, 0)
|
||||
/* can't use costly_spot() since its
|
||||
result depends upon hero's location */
|
||||
&& inside_shop(ox, oy)
|
||||
&& *(p = in_rooms(ox, oy, SHOPBASE))
|
||||
&& tended_shop(&rooms[*p - ROOMOFFSET]));
|
||||
}
|
||||
} else { /* saving */
|
||||
/* do not zero out o_ids for ghost levels anymore */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user