| 1133 | } |
| 1134 | |
| 1135 | staticfn struct bill_x * |
| 1136 | onbill(struct obj *obj, struct monst *shkp, boolean silent) |
| 1137 | { |
| 1138 | if (shkp) { |
| 1139 | struct bill_x *bp; |
| 1140 | int ct; |
| 1141 | |
| 1142 | for (ct = ESHK(shkp)->billct, bp = ESHK(shkp)->bill_p; |
| 1143 | ct > 0; --ct, ++bp) { |
| 1144 | if (bp->bo_id == obj->o_id) { |
| 1145 | if (!obj->unpaid) |
| 1146 | impossible("onbill: paid obj on bill?"); |
| 1147 | return bp; |
| 1148 | } |
| 1149 | } |
| 1150 | } |
| 1151 | if (obj->unpaid && !silent) |
| 1152 | impossible("onbill: unpaid obj %s?", |
| 1153 | !shkp ? "without shopkeeper" : "not on shk's bill"); |
| 1154 | return (struct bill_x *) 0; |
| 1155 | } |
| 1156 | |
| 1157 | /* used outside of shk.c when caller wants to know whether item is on bill |
| 1158 | but doesn't need to know any details about the bill itself */ |
no test coverage detected