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

Function useupf

src/invent.c:4762–4783  ·  view source on GitHub ↗

* uses up an object that's on the floor, charging for it as necessary */

Source from the content-addressed store, hash-verified

4760 * uses up an object that's on the floor, charging for it as necessary
4761 */
4762void
4763useupf(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.

Callers 15

dositFunction · 0.85
boulder_hits_poolFunction · 0.85
flooreffectsFunction · 0.85
moverock_coreFunction · 0.85
consume_offeringFunction · 0.85
offer_real_amuletFunction · 0.85
sacrifice_your_raceFunction · 0.85
pickup_objectFunction · 0.85
in_containerFunction · 0.85
tipcontainerFunction · 0.85
done_eatingFunction · 0.85
use_up_tinFunction · 0.85

Calls 7

splitobjFunction · 0.85
costly_spotFunction · 0.85
in_roomsFunction · 0.85
addtobillFunction · 0.85
stolen_valueFunction · 0.85
delobjFunction · 0.85
hideunderFunction · 0.85

Tested by

no test coverage detected