MCPcopy Create free account
hub / github.com/NetHack/NetHack / get_container_location

Function get_container_location

src/zap.c:840–859  ·  view source on GitHub ↗

* 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

Source from the content-addressed store, hash-verified

838 * if applicable.
839 */
840struct monst *
841get_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 */
862staticfn boolean

Callers 2

revive_corpseFunction · 0.85
reviveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected