MCPcopy Create free account
hub / github.com/NetHack/NetHack / get_pricing_units

Function get_pricing_units

src/shk.c:2845–2859  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2843}
2844
2845staticfn long
2846get_pricing_units(struct obj *obj)
2847{
2848 long units = obj->quan;
2849
2850 if (obj->globby) {
2851 /* globs must be sold by weight not by volume */
2852 long unit_weight = (long) objects[obj->otyp].oc_weight,
2853 wt = (obj->owt > 0) ? (long) obj->owt : (long) weight(obj);
2854
2855 if (unit_weight)
2856 units = (wt + unit_weight - 1L) / unit_weight;
2857 }
2858 return units;
2859}
2860
2861/* decide whether to apply a surcharge (or hypothetically, a discount) to obj
2862 if it had ID number 'oid'; returns 1: increase, 0: normal, -1: decrease */

Callers 9

get_cost_of_shop_itemFunction · 0.85
contained_costFunction · 0.85
set_costFunction · 0.85
add_one_tobillFunction · 0.85
addtobillFunction · 0.85
stolen_containerFunction · 0.85
stolen_valueFunction · 0.85
price_quoteFunction · 0.85
globby_bill_fixupFunction · 0.85

Calls 1

weightFunction · 0.85

Tested by

no test coverage detected