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

Function nxtobj

src/invent.c:1478–1491  ·  view source on GitHub ↗

sobj_at(&c) traversal -- find next object of specified type */

Source from the content-addressed store, hash-verified

1476
1477/* sobj_at(&c) traversal -- find next object of specified type */
1478struct obj *
1479nxtobj(struct obj *obj, int type, boolean by_nexthere)
1480{
1481 struct obj *otmp;
1482
1483 otmp = obj; /* start with the object after this one */
1484 do {
1485 otmp = !by_nexthere ? otmp->nobj : otmp->nexthere;
1486 if (!otmp)
1487 break;
1488 } while (otmp->otyp != type);
1489
1490 return otmp;
1491}
1492
1493/* return inventory object of type 'type' if hero has one, otherwise Null */
1494struct obj *

Callers 7

has_magic_keyFunction · 0.85
lift_objectFunction · 0.85
doloot_coreFunction · 0.85
meatcorpseFunction · 0.85
obj_nexto_xyFunction · 0.85
activate_statue_trapFunction · 0.85
its_deadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected