| 2843 | } |
| 2844 | |
| 2845 | staticfn long |
| 2846 | get_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 */ |
no test coverage detected