* Free obj from whatever list it is on in preparation for deleting it * or moving it elsewhere; obj->where will end up set to OBJ_FREE unless * it is already OBJ_LUAFREE or OBJ_DELETED. * Doesn't handle unwearing of objects in hero's or monsters' inventories. * * Object positions: * OBJ_FREE not on any list * OBJ_FLOOR fobj, level.locations[][] chains (use remove_obje
| 2554 | * OBJ_DELETED obj has been deleted from play but not yet deallocated |
| 2555 | */ |
| 2556 | void |
| 2557 | obj_extract_self(struct obj *obj) |
| 2558 | { |
| 2559 | switch (obj->where) { |
| 2560 | case OBJ_FREE: |
| 2561 | case OBJ_LUAFREE: |
| 2562 | case OBJ_DELETED: |
| 2563 | break; |
| 2564 | case OBJ_FLOOR: |
| 2565 | remove_object(obj); |
| 2566 | break; |
| 2567 | case OBJ_CONTAINED: |
| 2568 | extract_nobj(obj, &obj->ocontainer->cobj); |
| 2569 | container_weight(obj->ocontainer); |
| 2570 | obj->ocontainer = (struct obj *) 0; /* clear stale back-link */ |
| 2571 | break; |
| 2572 | case OBJ_INVENT: |
| 2573 | freeinv(obj); |
| 2574 | break; |
| 2575 | case OBJ_MINVENT: |
| 2576 | extract_nobj(obj, &obj->ocarry->minvent); |
| 2577 | obj->ocarry = (struct monst *) 0; /* clear stale back-link */ |
| 2578 | break; |
| 2579 | case OBJ_MIGRATING: |
| 2580 | extract_nobj(obj, &gm.migrating_objs); |
| 2581 | break; |
| 2582 | case OBJ_BURIED: |
| 2583 | extract_nobj(obj, &svl.level.buriedobjlist); |
| 2584 | break; |
| 2585 | case OBJ_ONBILL: |
| 2586 | extract_nobj(obj, &gb.billobjs); |
| 2587 | break; |
| 2588 | default: |
| 2589 | panic("obj_extract_self, where=%d", obj->where); |
| 2590 | break; |
| 2591 | } |
| 2592 | } |
| 2593 | |
| 2594 | /* Extract the given object from the chain, following nobj chain. */ |
| 2595 | void |
no test coverage detected