* uses up an object that's on the floor, charging for it as necessary */
| 4760 | * uses up an object that's on the floor, charging for it as necessary |
| 4761 | */ |
| 4762 | void |
| 4763 | useupf(struct obj *obj, long numused) |
| 4764 | { |
| 4765 | struct obj *otmp; |
| 4766 | boolean at_u = u_at(obj->ox, obj->oy); |
| 4767 | |
| 4768 | /* burn_floor_objects() keeps an object pointer that it tries to |
| 4769 | * useupf() multiple times, so obj must survive if plural */ |
| 4770 | if (obj->quan > numused) |
| 4771 | otmp = splitobj(obj, numused); |
| 4772 | else |
| 4773 | otmp = obj; |
| 4774 | if (!svc.context.mon_moving && costly_spot(otmp->ox, otmp->oy)) { |
| 4775 | if (strchr(u.urooms, *in_rooms(otmp->ox, otmp->oy, 0))) |
| 4776 | addtobill(otmp, FALSE, FALSE, FALSE); |
| 4777 | else |
| 4778 | (void) stolen_value(otmp, otmp->ox, otmp->oy, FALSE, FALSE); |
| 4779 | } |
| 4780 | delobj(otmp); |
| 4781 | if (at_u && u.uundetected && hides_under(gy.youmonst.data)) |
| 4782 | (void) hideunder(&gy.youmonst); |
| 4783 | } |
| 4784 | |
| 4785 | /* |
| 4786 | * Conversion from a class to a string for printing. |
no test coverage detected