Merge branch 'win-wip3.7' into win-wip3.7-bart
Conflicts: src/o_init.c
This commit is contained in:
41
src/shk.c
41
src/shk.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 shk.c $NHDT-Date: 1545036290 2018/12/17 08:44:50 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.143 $ */
|
||||
/* NetHack 3.6 shk.c $NHDT-Date: 1545383616 2018/12/21 09:13:36 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.144 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -2273,6 +2273,45 @@ register struct monst *shkp;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/* unlike alter_cost() which operates on a specific item, identifying or
|
||||
forgetting a gem causes all unpaid gems of its type to change value */
|
||||
void
|
||||
gem_learned(oindx)
|
||||
int oindx;
|
||||
{
|
||||
struct obj *obj;
|
||||
struct monst *shkp;
|
||||
struct bill_x *bp;
|
||||
int ct;
|
||||
|
||||
/*
|
||||
* Unfortunately, shop bill doesn't have object type included,
|
||||
* just obj->oid for each unpaid stack, so we have to go through
|
||||
* every bill and every item on that bill and match up against
|
||||
* every unpaid stack on the level....
|
||||
*
|
||||
* Fortunately, there's no need to catch up when changing dungeon
|
||||
* levels even if we ID'd or forget some gems while gone from a
|
||||
* level. There won't be any shop bills when arriving; they were
|
||||
* either paid before leaving or got treated as robbery and it's
|
||||
* too late to adjust pricing.
|
||||
*/
|
||||
for (shkp = next_shkp(fmon, TRUE); shkp;
|
||||
shkp = next_shkp(shkp->nmon, TRUE)) {
|
||||
ct = ESHK(shkp)->billct;
|
||||
bp = ESHK(shkp)->bill;
|
||||
while (--ct >= 0) {
|
||||
obj = find_oid(bp->bo_id);
|
||||
if (!obj) /* shouldn't happen */
|
||||
continue;
|
||||
if ((oindx != STRANGE_OBJECT) ? (obj->otyp == oindx)
|
||||
: (obj->oclass == GEM_CLASS))
|
||||
bp->price = get_cost(obj, shkp);
|
||||
++bp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* called when an item's value has been enhanced; if it happens to be
|
||||
on any shop bill, update that bill to reflect the new higher price
|
||||
[if the new price drops for some reason, keep the old one in place] */
|
||||
|
||||
Reference in New Issue
Block a user