* 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. */
| 2620 | * in tandem with extract_nobj, which does set it. |
| 2621 | */ |
| 2622 | void |
| 2623 | extract_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 |
no test coverage detected