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

Function offer_ok

src/eat.c:3538–3557  ·  view source on GitHub ↗

getobj callback for object to be offered (corpses and things that look like * the Amulet only */

Source from the content-addressed store, hash-verified

3536/* getobj callback for object to be offered (corpses and things that look like
3537 * the Amulet only */
3538staticfn int
3539offer_ok(struct obj *obj)
3540{
3541 if (!obj)
3542 return getobj_else ? GETOBJ_EXCLUDE_NONINVENT : GETOBJ_EXCLUDE;
3543
3544 if (obj->oclass != FOOD_CLASS && obj->oclass != AMULET_CLASS)
3545 return GETOBJ_EXCLUDE;
3546
3547 if (obj->otyp != CORPSE && obj->otyp != AMULET_OF_YENDOR
3548 && obj->otyp != FAKE_AMULET_OF_YENDOR)
3549 return GETOBJ_EXCLUDE_SELECTABLE;
3550
3551 /* suppress corpses on astral, amulets elsewhere
3552 * (!astral && amulet) || (astral && !amulet) */
3553 if (Is_astralevel(&u.uz) ^ (obj->oclass == AMULET_CLASS))
3554 return GETOBJ_DOWNPLAY;
3555
3556 return GETOBJ_SUGGEST;
3557}
3558
3559/* getobj callback for object to be tinned */
3560staticfn int

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected