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(). */
| 393 | * in do_reset_eat(). |
| 394 | */ |
| 395 | void |
| 396 | food_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, |
no test coverage detected