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

Function extract_nexthere

src/mkobj.c:2622–2640  ·  view source on GitHub ↗

* Extract the given object from the chain, following nexthere chain. * * This does not set obj->where, this function is expected to be called * in tandem with extract_nobj, which does set it. */

Source from the content-addressed store, hash-verified

2620 * in tandem with extract_nobj, which does set it.
2621 */
2622void
2623extract_nexthere(struct obj *obj, struct obj **head_ptr)
2624{
2625 struct obj *curr, *prev;
2626
2627 curr = *head_ptr;
2628 for (prev = (struct obj *) 0; curr; prev = curr, curr = curr->nexthere) {
2629 if (curr == obj) {
2630 if (prev)
2631 prev->nexthere = curr->nexthere;
2632 else
2633 *head_ptr = curr->nexthere;
2634 break;
2635 }
2636 }
2637 if (!curr)
2638 panic("extract_nexthere: object lost");
2639 obj->nexthere = (struct obj *) 0;
2640}
2641
2642/*
2643 * Add obj to mon's inventory. If obj is able to merge with something already

Callers 2

replace_objectFunction · 0.85
remove_objectFunction · 0.85

Calls 1

panicFunction · 0.50

Tested by

no test coverage detected