getobj callback for object to eat - effectively just wraps is_edible() */
| 3514 | |
| 3515 | /* getobj callback for object to eat - effectively just wraps is_edible() */ |
| 3516 | staticfn int |
| 3517 | eat_ok(struct obj *obj) |
| 3518 | { |
| 3519 | /* 'getobj_else' will be non-zero if floor food is present and |
| 3520 | player declined to eat that; used to insert "else" into |
| 3521 | "you don't have anything [else] to eat" if not carrying any food */ |
| 3522 | if (!obj) |
| 3523 | return getobj_else ? GETOBJ_EXCLUDE_NONINVENT : GETOBJ_EXCLUDE; |
| 3524 | |
| 3525 | if (is_edible(obj)) |
| 3526 | return GETOBJ_SUGGEST; |
| 3527 | |
| 3528 | /* make sure to exclude, not downplay, gold (if not is_edible) in order to |
| 3529 | * produce the "You cannot eat gold" message in getobj */ |
| 3530 | if (obj->oclass == COIN_CLASS) |
| 3531 | return GETOBJ_EXCLUDE; |
| 3532 | |
| 3533 | return GETOBJ_EXCLUDE_SELECTABLE; |
| 3534 | } |
| 3535 | |
| 3536 | /* getobj callback for object to be offered (corpses and things that look like |
| 3537 | * the Amulet only */ |
nothing calls this directly
no test coverage detected