* get_container_location() returns the following information * about the outermost container: * loc argument gets set to: * OBJ_INVENT if in hero's inventory; return 0. * OBJ_FLOOR if on the floor; return 0. * OBJ_BURIED if buried; return 0. * OBJ_MINVENT if in monster's inventory; return monster. * container_nesting is updated with the nesting depth
| 838 | * if applicable. |
| 839 | */ |
| 840 | struct monst * |
| 841 | get_container_location( |
| 842 | struct obj *obj, |
| 843 | int *loc, |
| 844 | int *container_nesting) |
| 845 | { |
| 846 | if (container_nesting) |
| 847 | *container_nesting = 0; |
| 848 | while (obj && obj->where == OBJ_CONTAINED) { |
| 849 | if (container_nesting) |
| 850 | *container_nesting += 1; |
| 851 | obj = obj->ocontainer; |
| 852 | } |
| 853 | if (obj) { |
| 854 | *loc = obj->where; /* outermost container's location */ |
| 855 | if (obj->where == OBJ_MINVENT) |
| 856 | return obj->ocarry; |
| 857 | } |
| 858 | return (struct monst *) 0; |
| 859 | } |
| 860 | |
| 861 | /* can zombie dig the location at x,y */ |
| 862 | staticfn boolean |
no outgoing calls
no test coverage detected