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] */
| 3234 | on any shop bill, update that bill to reflect the new higher price |
| 3235 | [if the new price drops for some reason, keep the old one in place] */ |
| 3236 | void |
| 3237 | alter_cost( |
| 3238 | struct obj *obj, |
| 3239 | long amt) /* if 0, use regular shop pricing, otherwise force amount; |
| 3240 | if negative, use abs(amt) even if it's less than old cost */ |
| 3241 | { |
| 3242 | struct bill_x *bp = 0; |
| 3243 | struct monst *shkp; |
| 3244 | long new_price; |
| 3245 | |
| 3246 | for (shkp = next_shkp(fmon, TRUE); shkp; shkp = next_shkp(shkp, TRUE)) |
| 3247 | if ((bp = onbill(obj, shkp, TRUE)) != 0) { |
| 3248 | new_price = !amt ? get_cost(obj, shkp) : (amt < 0L) ? -amt : amt; |
| 3249 | if (new_price > bp->price || amt < 0L) { |
| 3250 | bp->price = new_price; |
| 3251 | update_inventory(); |
| 3252 | } |
| 3253 | break; /* done */ |
| 3254 | } |
| 3255 | return; |
| 3256 | } |
| 3257 | |
| 3258 | /* called from doinv(invent.c) for inventory of unpaid objects */ |
| 3259 | long |
no test coverage detected