MCPcopy Index your code
hub / github.com/NetHack/NetHack / hold_potion

Function hold_potion

src/potion.c:2242–2262  ·  view source on GitHub ↗

call hold_another_object() to deal with a transformed potion; its weight won't have changed but it might require an extra slot that isn't available or it might merge into some other carried stack */

Source from the content-addressed store, hash-verified

2240 won't have changed but it might require an extra slot that isn't available
2241 or it might merge into some other carried stack */
2242staticfn void
2243hold_potion(
2244 struct obj *potobj,
2245 const char *drop_fmt, const char *drop_arg,
2246 const char *hold_msg)
2247{
2248 int cap = near_capacity(),
2249 save_pickup_burden = flags.pickup_burden;
2250
2251 /* prevent a drop due to current setting of the 'pickup_burden' option */
2252 if (flags.pickup_burden < cap)
2253 flags.pickup_burden = cap;
2254 /* remove from inventory after calculating near_capacity() */
2255 obj_extract_self(potobj);
2256 /* re-insert into inventory, possibly merging with compatible stack */
2257 potobj = hold_another_object(potobj, drop_fmt, drop_arg, hold_msg);
2258 nhUse(potobj);
2259 flags.pickup_burden = save_pickup_burden;
2260 update_inventory();
2261 return;
2262}
2263
2264/* #dip command - get item to dip, then get potion to dip it into;
2265 precede with 'm' to bypass fountain, pool, or sink at hero's spot */

Callers 1

potion_dipFunction · 0.85

Calls 4

near_capacityFunction · 0.85
obj_extract_selfFunction · 0.85
hold_another_objectFunction · 0.85
update_inventoryFunction · 0.85

Tested by

no test coverage detected