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

Function costly_adjacent

src/shk.c:5368–5381  ·  view source on GitHub ↗

called by sanity checking when an unpaid or no_charge item is not at a costly_spot; it might still be within the boundary of the shop; if so, those flags are still valid */

Source from the content-addressed store, hash-verified

5366 costly_spot; it might still be within the boundary of the shop; if so,
5367 those flags are still valid */
5368boolean
5369costly_adjacent(
5370 struct monst *shkp,
5371 coordxy x, coordxy y)
5372{
5373 struct eshk *eshkp;
5374
5375 if (!shkp || !inhishop(shkp) || !isok(x, y))
5376 return FALSE;
5377 eshkp = ESHK(shkp);
5378 /* adjacent if <x,y> is a shop wall spot, including door;
5379 also treat "free spot" one step inside the door as adjacent */
5380 return (levl[x][y].edge || (x == eshkp->shk.x && y == eshkp->shk.y));
5381}
5382
5383/* called by dotalk(sounds.c) when #chatting; returns obj if location
5384 contains shop goods and shopkeeper is willing & able to speak */

Callers 6

rlocoFunction · 0.85
place_objectFunction · 0.85
shop_obj_sanityFunction · 0.85
really_kick_objectFunction · 0.85
set_repo_locFunction · 0.85
litter_scatterFunction · 0.85

Calls 2

inhishopFunction · 0.85
isokFunction · 0.85

Tested by

no test coverage detected