MCPcopy Index your code
hub / github.com/NetHack/NetHack / billable

Function billable

src/shk.c:3447–3487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3445}
3446
3447RESTORE_WARNING_FORMAT_NONLITERAL
3448
3449/* decide whether a shopkeeper thinks an item belongs to her */
3450boolean
3451billable(
3452 struct monst **shkpp, /* in: non-null if shk has been validated;
3453 * out: shk */
3454 struct obj *obj,
3455 char roomno,
3456 boolean reset_nocharge)
3457{
3458 struct monst *shkp = *shkpp;
3459
3460 /* if caller hasn't supplied a shopkeeper, look one up now */
3461 if (!shkp) {
3462 if (!roomno)
3463 return FALSE;
3464 shkp = shop_keeper(roomno);
3465 if (!shkp || !inhishop(shkp))
3466 return FALSE;
3467 *shkpp = shkp;
3468 }
3469 /* perhaps we threw it away earlier */
3470 if (onbill(obj, shkp, FALSE)
3471 || (obj->oclass == FOOD_CLASS && obj->oeaten))
3472 return FALSE;
3473 /* outer container might be marked no_charge but still have contents
3474 which should be charged for; clear no_charge when picking things up */
3475 if (obj->no_charge) {
3476 if (!Has_contents(obj) || (contained_gold(obj, TRUE) == 0L
3477 && contained_cost(obj, shkp, 0L, FALSE,
3478 !reset_nocharge) == 0L))
3479 shkp = 0; /* not billable */
3480 if (reset_nocharge && !shkp && obj->oclass != COIN_CLASS) {
3481 obj->no_charge = 0;
3482 if (Has_contents(obj))
3483 picked_container(obj); /* clear no_charge */
3484 }
3485 }
3486 return shkp ? TRUE : FALSE;
3487}
3488
3489void
3490addtobill(

Callers 7

costly_alterationFunction · 0.85
fracture_rockFunction · 0.85
add_one_tobillFunction · 0.85
addtobillFunction · 0.85
stolen_containerFunction · 0.85
stolen_valueFunction · 0.85
globby_bill_fixupFunction · 0.85

Calls 6

shop_keeperFunction · 0.85
inhishopFunction · 0.85
onbillFunction · 0.85
contained_goldFunction · 0.85
contained_costFunction · 0.85
picked_containerFunction · 0.85

Tested by

no test coverage detected