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

Function dig_typ

src/dig.c:168–192  ·  view source on GitHub ↗

When digging into location , what are you actually digging into? */

Source from the content-addressed store, hash-verified

166
167/* When digging into location <x,y>, what are you actually digging into? */
168int
169dig_typ(struct obj *otmp, coordxy x, coordxy y)
170{
171 int ltyp;
172
173 if (!isok(x, y) || !otmp || (!is_pick(otmp) && !is_axe(otmp)))
174 return DIGTYP_UNDIGGABLE;
175
176 ltyp = levl[x][y].typ;
177 if (is_axe(otmp))
178 return closed_door(x, y) ? DIGTYP_DOOR
179 : IS_TREE(ltyp) ? DIGTYP_TREE /* axe vs tree */
180 : DIGTYP_UNDIGGABLE;
181 /*assert(is_pick(otmp));*/
182 return (sobj_at(STATUE, x, y) && pick_can_reach(otmp, x, y))
183 ? DIGTYP_STATUE
184 : (sobj_at(BOULDER, x, y) && pick_can_reach(otmp, x, y))
185 ? DIGTYP_BOULDER
186 : closed_door(x, y) ? DIGTYP_DOOR
187 : IS_TREE(ltyp) ? DIGTYP_UNDIGGABLE /* pick vs tree */
188 : (IS_OBSTRUCTED(ltyp)
189 && (!svl.level.flags.arboreal || IS_WALL(ltyp)))
190 ? DIGTYP_ROCK
191 : DIGTYP_UNDIGGABLE;
192}
193
194boolean
195is_digging(void)

Callers 4

domove_fight_emptyFunction · 0.85
digFunction · 0.85
use_pick_axeFunction · 0.85
use_pick_axe2Function · 0.85

Calls 4

isokFunction · 0.85
closed_doorFunction · 0.85
sobj_atFunction · 0.85
pick_can_reachFunction · 0.85

Tested by

no test coverage detected