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

Function extract_nobj

src/mkobj.c:2595–2614  ·  view source on GitHub ↗

Extract the given object from the chain, following nobj chain. */

Source from the content-addressed store, hash-verified

2593
2594/* Extract the given object from the chain, following nobj chain. */
2595void
2596extract_nobj(struct obj *obj, struct obj **head_ptr)
2597{
2598 struct obj *curr, *prev;
2599
2600 curr = *head_ptr;
2601 for (prev = (struct obj *) 0; curr; prev = curr, curr = curr->nobj) {
2602 if (curr == obj) {
2603 if (prev)
2604 prev->nobj = curr->nobj;
2605 else
2606 *head_ptr = curr->nobj;
2607 break;
2608 }
2609 }
2610 if (!curr)
2611 panic("extract_nobj: object lost");
2612 obj->where = OBJ_FREE;
2613 obj->nobj = (struct obj *) 0;
2614}
2615
2616/*
2617 * Extract the given object from the chain, following nexthere chain.

Callers 7

nhl_gamestateFunction · 0.85
free_tutorialFunction · 0.85
freeinvFunction · 0.85
doorganize_coreFunction · 0.85
replace_objectFunction · 0.85
remove_objectFunction · 0.85
obj_extract_selfFunction · 0.85

Calls 1

panicFunction · 0.50

Tested by

no test coverage detected