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

Function food_disappears

src/eat.c:395–403  ·  view source on GitHub ↗

When food decays, in the middle of your meal, we don't want to dereference * any dangling pointers, so set it to null (which should still trigger * do_reset_eat() at the beginning of eatfood()) and check for null pointers * in do_reset_eat(). */

Source from the content-addressed store, hash-verified

393 * in do_reset_eat().
394 */
395void
396food_disappears(struct obj *obj)
397{
398 if (obj == svc.context.victual.piece)
399 svc.context.victual = zero_victual; /* victual.piece = 0, .o_id = 0 */
400
401 if (obj->timed)
402 obj_stop_timers(obj);
403}
404
405/* renaming an object used to result in it having a different address,
406 so the sequence start eating/opening, get interrupted, name the food,

Callers 1

obfreeFunction · 0.85

Calls 1

obj_stop_timersFunction · 0.85

Tested by

no test coverage detected